pete stein wrote:In this code:
What is the source? It's the component that when clicked/pressed/checked tells its actionlisteners to perform their actionPerformed method.
So what sets off the actionlistener here? A JTextField? Or is it the JCheckBox? If the latter, what's going to happen if you try to cast it to a JTextField?
ethaniel landfough wrote:JCheckBox sets off the actioListener.
Do i have to use ItemListener for the JCheckBox or actionListeners can also do it?
pete stein wrote:
ethaniel landfough wrote:JCheckBox sets off the actioListener.
Correct
I have changed it into something like this : (No error, but nothing happen). Is there something else that i missed?
ethaniel landfough wrote:
pete stein wrote:
What is answer = ans supposed to be doing here? Showing all of the text held in your JTextFields? If so, it won't be this simple to do as to accomplish this you'll have to iterate through your JTextField array changing each field as you go. In fact, it appears that you have to declare a JTextField 2-D array here (or perhaps a 2-D Box array) in order to be able to access them or change them.
ethaniel landfough wrote:You mean something like this?
pete stein wrote:
Before asking on the forum, "something like this?", first compile and run the code, and answer for yourself the question, "does this work? Does it change the display in any positive way?"
To figure out the logic here, please note that within this actionPerformed method you are creating a bunch of new Box objects. Is it possible that setting the text of these new non-displayed Box objects will change the displayed text of the Box objects shown in the JFrame? Let me state again: "...In fact, it appears that you have to declare a JTextField 2-D array here (or perhaps a 2-D Box array) in order to be able to access them or change them."
ethaniel landfough wrote:I'm sorry. My friend accidentally clicked the submit button when i left the computer for a moment (because i'm using the computer at the college library). And i forgot to edit the question.
pete stein wrote:
ethaniel landfough wrote:I'm sorry. My friend accidentally clicked the submit button when i left the computer for a moment (because i'm using the computer at the college library). And i forgot to edit the question.
I'm not sure what you're getting at here. Regardless, best of luck.
ethaniel landfough wrote:
I have been thinking about what you said earlier if i'm not getting it wrong. Is this already right?
pete stein wrote: Does this make sense?