Hi All! First thanks for viewing my thread. I have spent a half day and change trying to find a solution to this specific problem.
Basically I am trying to figure out how to change the variable name while in a loop. The last loop is where my problem is with some comment code describing a little bit about whats going on. Thanks for the help in advance.
//Class Constructor method
public Display(Main inMain, int numGui) {
System.out.println("Display(Main inMain)--from Display");
//place gui's inside an arraylist
guiArray.add(gui);
guiArray.add(gui2);
guiArray.add(gui3);
guiArray.add(gui4);
this.main = inMain;
//find the number of guis to delete out of four possible
int numDelete = -numGui + 4 ;
System.out.println("Start Size" + guiArray.size());
for(int j = 0; j<numDelete; j++){
//delete the gui's we do not need
guiArray.remove(0);
}
System.out.println("Stop Size" + guiArray.size());
for(int n = 0; n< guiArray.size(); n++){
guiArray.get(n);
// guiArray.get(n) = new Gui(this); **I need this line
// I need this line to display the gui properly but it gives
//me the error "the left hand side of an assignment
//must be a variable" so I might have to use if statements
//but then the code is not scaleable to I am confused.
}
/*
gui = new Gui(this);// gui
gui2 = new Gui(this);
gui3 = new Gui(this);
gui4 = new Gui(this);
*/
}