I am creating the list in the action listener I think it is re-initializing it. I tried setting up a variable in the main class but the action listener cannot pick up on it. I'm guessing that I need to pass it to the action listener but I am not sure how to do that. Here is my action listener code, its an item state changed since I'm looking at JCheckBox's.
To clarify I am trying to make the array out_kitchen_bros available to the itemstatechanged
and here is where I declare the variables that I think to try and make them available.
Appreciate the help. I am newish to java mainly just haven't done much of it recently and having trouble remembering some of the basics.
Works a lot better now.
I cannot see your checkbox objects, but did you remember to setPropertyChangeListener to the listeners you have built?
Also I agree with you on changing it to an ArrayList. It'll make the logic easier for your experiment.
Richard Alves wrote:http://docs.oracle.com/javase/1.4.2/docs/api/java/util/ArrayList.html
Please don't post links to the API for old Java versions which are long past EOL.
Here's the Java SE 6 API: http://docs.oracle.com/javase/6/docs/api/
And this is for Java SE 7: http://docs.oracle.com/javase/7/docs/api/
Also, it would have been nice if you had acknowledged Michael's help in your earlier thread before asking a follow-up question.
To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
This may be what you need ... or not.
Victor M. Pereira wrote:did you remember to setPropertyChangeListener to the listeners you have built?
Which class has a method setPropertyChangeListener? I couldn't find a method with that name anywhere in the Swing API.
Also, what do property changes have to do with the question?
Darryl Burke wrote:what do property changes have to do with the question?
Sorry about the setProperty I was doing it from my own memory. The method name actually is: createActionPropertyChangeListener(Action a) . Is a factory method that creates the propertyChangeListener and it works every time it gets from true to false the JCheckBox. Also if you watch the JComponent you'll see the addPropertyChangeListener(PropertyChangeListener pcl). Meanning that it'll react to just not clicking, but also to the change of value making it easy to test.
And it has to do with the point that I haven't seen the part of the code where he sets its actionlisteners or propertychangelisteners. And also the GUI part where he creates his JCheckBox.