|
|
Re: Question about button action in a gui
|
Posted: Jun 16, 2005 4:14 AM
|
|
No examples for homework, hust hints.
1. set the value to insert as actionCommand for each button (or as text if you want).
2. create one actionlistener. 2.1 add this actionlistener to all Buttons 2.2 (AbstractButton)event.getSource() is the buttonmodel of the pressed button. 2.3 getText() gives you the displayed Text, getActionCommand() the action command of the ButtonModel from 2.2 2.4 get The current Text from the textfield with getText() 2.5 set the new text using a concatenator (s = s1 + s2).
|
|