JButtons re-enable themselves after being disabled

Posted by Anarchist on Stack Overflow See other posts from Stack Overflow or by Anarchist
Published on 2010-04-14T19:26:53Z Indexed on 2010/04/15 16:23 UTC
Read the original article Hit count: 230

Filed under:
|
|
|
|

I have an array of JButtons which form a keypad interface. After six numbers are entered I want to disable the keypad so that no further numbers can be entered by the user.

I have written the code and the buttons do disable until the mouse hovers above any of them, then the buttons seem to re-enable themselves and run actionEvents added to them.

The full code is available here.

Possible things that I think are wrong.

  1. There is some sort of MouseListener which is ignoring when I set button.setEnabled(false);
  2. I haven't separated attributes from the buildGUI(); correctly, I only did this anyway so that the inner class could access them.
  3. Possibly something to do with the gridLayout as disabling the buttons seems to work for my services JPanel buttons.

© Stack Overflow or respective owner

Related posts about java

Related posts about swing