Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java problem, disabled controls still fires events!

Tags:

java

swing

I'm new to Java, I'm coding on NetBeans. The problem is that whenever I disable a control i.e jmenu.setEnabled(false) it still fires events! holy crap! how is it! :P

How can I prevent it?

like image 666
Arturo Avatar asked Apr 10 '26 06:04

Arturo


1 Answers

From the javadoc:

Note: Disabling a lightweight component does not prevent it from receiving MouseEvents.

Note: Disabling a heavyweight container prevents all components in this container from receiving any input events. But disabling a lightweight container affects only this container.

You might want to check out disableEvents(long mask).

like image 179
JRL Avatar answered Apr 11 '26 20:04

JRL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!