LesPaul59
05-13-2003, 08:59 PM
Hello Everybody!
I have a Java type question: Say i have a 2 Text boxes. I want it so that if text 1 says for instance "hi", i want text 2 to say "goodbye!"
How would i go about doing this?
Mike
LesPaul59
05-13-2003, 10:10 PM
Whoops:
It should be: Say i have a 2 Text boxes. I want it so that if text 1 says for instance "hi", i want the user to press a button, and then text 2 will say "goodbye!"
I would have made an edit...but the 5 minute time expired..sorry.
Mike
amicus
05-14-2003, 02:11 PM
you have to implement 'ActionListener' then add the 'ActionListener' to the button. once the button is clicked it'll call the actionPerformed( ActionEvent ae ) method (you have to implement it) and the 'ActionEvent' object is passed in. you'll be able to get which button is clicked using the 'ActionEvent'.
both 'TextField' and 'JTextField' inherits 'getText()' and 'setText()' methods so that's how you'll get the text and set the text.
i'm assuming you mean java and not javascript :)