Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Disabled components: to popup or not to popup context menu?

kleopatra-JavaNetFeb 8 2011 — edited Feb 12 2011
Hi experts,

just noticed that Swing pops up a component menu on mouse click even if the component isn't enabled. Seems to contradict the general rule to not allow "active" interaction (vs. "passive" as f.i. still showing the tooltip, the distinction is probably freely invented but serves me well enough ;) with a disabled component.

Could half-way live with that - except that then all menu items need to be disabled individually. Another option would be to return a null componentPopup if disabled. Not generally applicable because requires subclassing. Yet another might be to force-inject a MouseListener into the rootPane: it would intercept and swallow the popup triggers if the target is disabled, otherwise delegate to the ui-installed listener.

Comments please?

Thanks
Jeanette
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 12 2011
Added on Feb 8 2011
11 comments
792 views