This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Modify JToolBar buttons and actions  RSS feed

 
Vladislav Semenov
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I change the Action of JButton if I have JToolBar instance?
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a JButton in a JToolBar. Regardless of where the JButton is, you can give it an action listener with myButton.addActionListener and then in the action listener you tell the application what to do when the button is pressed.

Is that what you mean by change the action?

Cheers,
Rachel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!