Now stuck with inserting data into a list.
Hi again!
I'm hoping one day that I won't actually need to keep asking for help on this forum but unfortunatly, I am stuck once again ><
I have two classes, which include two Jpanels. One of the Jpanels has a list in it, the other has a button. What I want to do, is when the person presses the button in one window, it adds some information to a list in the second window.
Rather than posting all the code I am just going to post all the relevent information. Here is the actionListener that detects the button has been pressed:
Code:
private void buttonActionPerformed(java.awt.event.ActionEvent evt) {
if (button.getActionCommand().equals("Yes")){
chosenList cl = new chosenList();
cl.addList("Yes");
}
}
This sends the string "Yes" to this method in the other class which contains the List.:
Code:
public void addList(String name) {
list.add(name);
System.out.println(name);
}
I know that addList is recieving "Yes" as using the sout command it prints it out in the runtime window everytime I press the button. The problem is, for some reason it is not adding the String to the list. I have even tried going direct by putting inside the actionListener cl.list("Yes"); but with no luck.