views:

58

answers:

1

Hi,

I'm building a drop down menu which resides in program menu bar and pops up a JPopupMenu if a JButton gets clicked. In the JPopupMenu there are multiple JMenuItems.

However, beside every JMenuItem it shows a checkbox! Which looks like this:

alt text

I don't think it should, and there is explicit JCheckBoxMenuItem for that.

Does anyone know why a check box appears in a JMenuItem and how do I disable / remove it?

The code

ImageIcon icon = ViewUtilities.createIcon("resource/gui/mainMenu.png", _buttonLength); setIcon(icon);

JMenuItem menuItem = new JMenuItem("New Whiteboard"); menuItem.addActionListener(new NewWhiteboardActionListener()); getMenu().add(menuItem);

menuItem = new JMenuItem("Open..."); menuItem.addActionListener(new OpenFileActionListener()); getMenu().add(menuItem);

menuItem = new JMenuItem("Preferences..."); menuItem.addActionListener(new PreferencesActionListener()); getMenu().addSeparator(); getMenu().add(menuItem);

menuItem = new JMenuItem("Exit"); menuItem.addActionListener(new ExitActionListener()); getMenu().addSeparator(); getMenu().add(menuItem);

where getMenu() returns a JPopupMenu.

Thanks!

Cheers,
Shuo


Edit: I've fixed it. The problem is on Jide library. I've used it for a custom LAF of TabbedPanel. And it injects LAF for popup menus too as long as it's load.

So the solution is too set it to don't load menu styles.

LookAndFeelFactory.installJideExtension(
  LookAndFeelFactory.VSNET_STYLE_WITHOUT_MENU);
A: 

The problem is on Jide library. I've used it for a custom LAF of TabbedPanel. And it injects LAF for popup menus too as long as it's load.

So the solution is too set it to don't load menu styles.

LookAndFeelFactory.installJideExtension(
  LookAndFeelFactory.VSNET_STYLE_WITHOUT_MENU);
zavié