Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActionEvent and Array..?

Status
Not open for further replies.

sebastiaan

Programmer
Aug 15, 2001
4
BE
I have an array of togglebuttons; JToggleButton JToggelButt[] = new ToggleButton[100];

later in the actionevent i want to know which button is clicked!
with e.GetActionObject() i can get the label of the button but not the number of the array!

Because i want to change the backcolor of the togglebutton if he's clicked in the color chosen in the application it also must be disabled if clicked!

who knows ho to achieve this?

thx

s
 
In the JToggleButton there is property called actionCommand.
So when creating the buttons set action command to the index of that button using setActionCommand() now in your actionlistener when you get the ActionEvent You get the action command of that button which triggred the event Now From that you can find the index of the JToggleButton clicked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top