开发者

How to find in Java if JToggleButton is pressed

How to find in Java if JToggleButton is pressed 开发者_如何学Cand if it is pressed to set to be unpressed ?


All such things you can get from ButtonModel.

getModel().isPressed()


Have you try the isSelected() method ?


or inside public void actionPerformed(ActionEvent event) {...} is possible to check

AbstractButton abstractButton = (AbstractButton) event.getSource();
boolean selected = abstractButton.getModel().isSelected();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜