I have a problem with开发者_运维知识库 Swing JButtons. I'm working with Netbeans. When I disable a JButton in the GUI Builder it still fires the actions attached as events, i.e. I have a disabled button with an onClick trigger. No matter if disable, the trigger is working.
Somebody knows how to avoid this behavior? and the disabled jbutton fires the actions just when enabled?
Thanks a lot
You need to use an ActionListener vs a MouseClickListener.
Technically, the user did click in your button. :)
http://download.oracle.com/javase/tutorial/uiswing/events/actionlistener.html
Did you try a button.setEnabled(false) in code ? Maybe Netbeans is not setting the property properly...
精彩评论