Paul Clapham wrote:Well, yes, there is something wrong with your question. Sorry, but it's far too long to be read and understood due to the large volume of code which is not relevant to the problem. I looked at it twice and gave up on the idea of trying to answer because of that.
So have a look at the SSCCE (Short, Self Contained, Correct (Compilable), Example) page which describes how you can produce a much better code example for your question.
Swastik
Swastik
Why an array?Amie Mac wrote: . . .
1. When clicking on the Add button, the button text should change to Click to Add! so the user should click it to add the item to an array
You can create listeners which call certain methodsBut if you are setting them editable when you push the button, how is the user supposed to enter anything beforehand? And how are you setting them uneditable?2. When the Add button is clicked it would make the appropriate JTextFields editable . . .
Campbell Ritchie wrote:
Why an array?Amie Mac wrote: . . .
1. When clicking on the Add button, the button text should change to Click to Add! so the user should click it to add the item to an array
You realise the change in button text may cause the whole display to change strangelyYou can create listeners which call certain methodsBut if you are setting them editable when you push the button, how is the user supposed to enter anything beforehand? And how are you setting them uneditable?2. When the Add button is clicked it would make the appropriate JTextFields editable . . .
Go through the JTextComponent class and its subclasses. You will probably find you can add action listeners to them, and they can be activated by pushing the enter key while the component has focus.
For things more complicated you can consider key bindings and document listeners. Also find somebody who knows more about them than I do!
Note I am not creating a Listener there but using a λ. It only works in Java8.
It's all Greek to meAmie Mac wrote:. . .
By the way, what is λs? . . .
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |