Answer the question
In order to leave comments, you need to log in
In Java (Swing), the element is clickable even though it is set to setEnabled(false). What to do?
Actually, the whole question is in the title and video ...
The button, which, at the time of loading and preprocessing, should be inactive, continues to respond to mouse clicks, although it is explicitly told: button.setEnabled(false); The button fires on a mouse click, but exactly the same thing happens with onMousePressed.
A lot of unnecessary threads begin to multiply, an abnormal amount of memory is “guzzled” and other obvious inconveniences ...
How to avoid this?
Answer the question
In order to leave comments, you need to log in
Note: Disabling a lightweight component does not prevent it from receiving MouseEvents.JavaDoc
Can additionally check the activity of the button in the click handler?
Is the listener defined correctly? and what event are you "listening" to?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question