ItemStateChanged on JButton

I read that it JButtonimplements ItemSelectable, and it has a method in the documentation addItemListener, so I can argue that it can generate ItemEvent... but when do I register with JButton(but also for a JMenuItem) that is not related to the event?

Why?

I understand that if in docs it is reported that the component has an addition ... Listener this means that it supports this event ... but for experience it is not so often ...

What is the truth?

+3
source share
1 answer

( ActionEvent) "" ( ItemEvent). a JButton javax.swing.DefaultButtonModel. setPressed setSelected , , .

, JButton.setSelected, . , .

, JButton ( , , a JToggleButton) , , , .

+3

Source: https://habr.com/ru/post/1764675/


All Articles