Danka
Danka

Reputation: 291

How to call from code like that button clicked?

I have in code implement ActionListener for JToggleButton. How to call from code like that button clicked? (similar in javascript from code I can do $('button').click();) How to do this in Java?

Upvotes: 2

Views: 232

Answers (3)

mKorbel
mKorbel

Reputation: 109813

you have to reads basic tutorial for JButton and ActionListener , examples for that here and here

Upvotes: 1

Adeel Ansari
Adeel Ansari

Reputation: 39907

For JButton we have button.doClick(), inherited from AbstractButton. So, we should have doClick() for JToggleButton() as well, since that is also derived from AbstractButton.

Upvotes: 4

TabbyCool
TabbyCool

Reputation: 2839

This might be useful... http://zetcode.com/tutorials/javaswingtutorial/swingevents/

Upvotes: 1

Related Questions