Reputation: 291
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
Reputation: 109813
you have to reads basic tutorial for JButton and ActionListener , examples for that here and here
Upvotes: 1
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
Reputation: 2839
This might be useful... http://zetcode.com/tutorials/javaswingtutorial/swingevents/
Upvotes: 1