I am creating a Java application which exists out of a jFrame that is empty upon start and can include an undefined amount of instances of a jPanel. image:
The idea is that every time the user presses 'Nieuw subnet aanmaken' a new instance of the object Subnet is made, and is stored in a arraylist. The user enters data through a series of pop-ups.
After the creation of the object a jPanel 'Netwerk' is created, with the goal of displaying the network's details. Is it possible that I supply that jPanel with a integer specifying the location of its correcponding 'Subnet' (the logical class, containing, subnetmask, name, ..) in the list that is kept in the jFrame, so that it can acces and write to that instance in the list?
Like:
private void jButton_NetwerkenActionPerformed(java.awt.event.ActionEvent evt) {
//create new subnet in the arraylist at location i
//..
//then make a new panel and suply it with the index of its subnet object in the arraylist
this.jPanel1.add(new Netwerk(i));
}