File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Modify JToolBar buttons and actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Modify JToolBar buttons and actions" Watch "Modify JToolBar buttons and actions" New topic

Modify JToolBar buttons and actions

Vladislav Semenov

Joined: Mar 01, 2004
Posts: 5
How can I change the Action of JButton if I have JToolBar instance?
Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
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?

I agree. Here's the link:
subject: Modify JToolBar buttons and actions
jQuery in Action, 3rd edition