All My JMenuItems Have JCheckBoxes!!!

Understandably, if you're creating an application and all your menu items suddenly have checkboxes, as shown below, you'll not be very happy.

Debugging this problem is next to impossible. The only question you should be asking yourself if you see something like the above is: "Am I using JIDE?"

As you can read here, the problem relates to JIDE and the fact that it overrides some global settings in certain cases. Thanks to Rob Terpilowski from Lynden in Seattle (where yet another NetBeans Platform application is being created), the solution is to put these statements into the "restored" method of your "ModuleInstall" class:

        LookAndFeelFactory.installDefaultLookAndFeel();
        LookAndFeelFactory.installJideExtension();

And here's an issue where the above is reported and the solution above works there too:

http://netbeans.org/bugzilla/show_bug.cgi?id=200756

Comments:

Thank you for this blog entry. I encountered this problem a long time ago and never discovered the cause of it. After quite a bit of trial and effort, I managed to figure out that calling SwingUtilities.updateComponentTreeUI specifically on each menu bar (rather than a menu bar's parent Window only) would fix the problem, but this is a better solution.

Posted by Ryan on August 16, 2011 at 11:57 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today