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
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
It's not a secret anymore!