• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modify JToolBar buttons and actions

 
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