sezak
2009-08-14 21:46:09 UTC
I addActionListener to button solveIt.
However, i have several buttons and thus i don't want to create a separate actionPerformed for each. Thus, i create ONE actionPerformed() method that checks for each button.
Inside actionPerformed, if the button is called solveIt, the focus goes to the textField called yourAnswer. I addActionListener to the textField here. But i am already in actionPerformed method. Do i make another actionPerformed function inside? I need to catch the text entered into the textField and read it into a string and compare it with solution, etc.
I don't want to allow the user to simply enter the textfield without pressing on the button solveIt.
How do i solve this problem?