Checkmark Icon on JMenuItem in Vista

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Checkmark Icon on JMenuItem in Vista

Postby adamtaft » Tue Apr 21, 2009 7:54 pm

Hi,

I am getting a checkmark icon on my JMenuItem only after initializing a JideSplitPane (or I assume any other Jide component). The problem is only seen on the system look & feel for Vista. It may happen on XP too, haven't checked.

Note in the following code, a checkmark icon appears next to the "Test Menu Item." Commenting out the "new JideSplitPane()" call allows the JMenuItem to be created correctly (ie. no checkmark / no Jide components initialized).

Additionally, if the call to "new JideSplitPane()" is made before the JMenuItem, a different gradient icon is displayed and the menu coloration is wrong.

Thanks.

Adam

Code: Select all

import java.awt.Dimension;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.UIManager;
import javax.swing.WindowConstants;

import com.jidesoft.swing.JideSplitPane;

public class JMenuItemTest implements Runnable {

   @Override
   public void run() {
      
      JFrame frame = new JFrame("Just a Test");
      frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
      frame.setPreferredSize(new Dimension(300, 200));
      
      // call new JideSplitPane() here to see the other problem.
      
      JMenuItem menuItem = new JMenuItem("Test Menu Item");
      JMenu menu = new JMenu("Menu");
      JMenuBar menuBar = new JMenuBar();
      menu.add(menuItem);
      menuBar.add(menu);
      frame.setJMenuBar(menuBar);

      // for whatever reason, calling a new JideSplitPane() causes a checkmark to appear
      // on the JMenuItem.  I am assuming initialization of any Jide component will do this.
      // look at the checkmark icon on the JMenuItem 'Just a Test'
      // comment out this line to see "normal" behavior
      //
      // Note that moving this call to above the JMenuItem construction creates a totally different
      // icon related problem, some sort of gradient as the icon.  If the JMenuItem is created,
      // you get the checkmark.  If it's not created yet, you get a blue-to-whiteish diagnol gradient.
      // Additionally, the coloration of the menu item is not correct when calling the new JideSplitPane
      // before the JMenuItem creation.
      new JideSplitPane();

      
      frame.pack();
      frame.setLocationByPlatform(true);
      frame.setVisible(true);
   }
   
   public static void main(String[] args) throws Exception {
      // Note, this is seen on Vista
      // Unsure about other platforms, like XP.
      // Default look & feel doesn't have the problem (Metal, etc.)
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      
      EventQueue.invokeLater(new JMenuItemTest());
   }
   
}

adamtaft
 
Posts: 1
Joined: Tue Apr 21, 2009 7:42 pm

Re: Checkmark Icon on JMenuItem in Vista

Postby JIDE Support » Tue Apr 21, 2009 11:36 pm

Thanks for your test case. We do notice the wierd behavior and will figure it out. Will let you know when we have a release to fix it.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Checkmark Icon on JMenuItem in Vista

Postby JIDE Support » Wed Apr 22, 2009 10:05 am

The reason is JideSplitPane will automatically call LookAndFeelFactory.installJideExtension. However, at that point, your menu is already created. installJideExtension changes some of the UIDefaults the menu is using which causes the check mark to be shown. Do you need to use JIDE Action Framework? If not, you can call

LookAndFeelFactory.installJideExtension( LookAndFeelFactory.VSNET_STYLE_WITHOUT_MENU)

at the beginning of the main() after you set the L&F.

Thanks
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Checkmark Icon on JMenuItem in Vista

Postby JIDE Support » Fri May 01, 2009 7:57 pm

Just so you know, the check mark bug is fixed in 2.6.2 release.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Checkmark Icon on JMenuItem in Vista

Postby rbakhru1 » Thu Sep 27, 2012 11:56 am

Hi - We're seeing this on Windows 7 using JIDE 3.1. Note that your suggested fix of installing the extension without menu works, but looks like the bug has crept back into the regular codebase?
Thanks
rbakhru1
 
Posts: 3
Joined: Thu Jul 28, 2011 11:57 am

Re: Checkmark Icon on JMenuItem in Vista

Postby JIDE Support » Thu Sep 27, 2012 12:14 pm

Could you please post an image to show the issue so that we could better understand your situation?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Checkmark Icon on JMenuItem in Vista

Postby rbakhru1 » Thu Sep 27, 2012 12:22 pm

See attached images
Attachments
jide-bug-with-fix.png
This is how it looks (correct) if we add LookAndFeelFactory.installJideExtension(LookAndFeelFactory.VSNET_STYLE_WITHOUT_MENU)
after the UIManager call in the test code earlier in this thread.
jide-bug-with-fix.png (5.81 KiB) Viewed 26819 times
jide-bug.png
This is the version without the installJideExtension call
jide-bug.png (6.16 KiB) Viewed 26819 times
rbakhru1
 
Posts: 3
Joined: Thu Jul 28, 2011 11:57 am

Re: Checkmark Icon on JMenuItem in Vista

Postby JIDE Support » Thu Sep 27, 2012 1:11 pm

If you don't explicitly invoke LookAndFeelFactory#installJideExtension(), JIDE will automatically call it for you. That's how the behavior differs. Please always invoke LookAndFeelFactory#installJideExtension(LookAndFeelFactory#VSNET_STYLE_WITHOUT_MENU) if you don't like the check box behavior.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Checkmark Icon on JMenuItem in Vista

Postby rbakhru1 » Thu Sep 27, 2012 1:18 pm

It seems odd and un-intuitive that the default system behavior is to overwrite user-specified icons with checkboxes. (If you create the menu items with icons specified, they're completely ignore/replaced with these checkboxes).
rbakhru1
 
Posts: 3
Joined: Thu Jul 28, 2011 11:57 am

Re: Checkmark Icon on JMenuItem in Vista

Postby JIDE Support » Thu Sep 27, 2012 1:27 pm

If JIDE Action product is not in the class path, the default style would be XXX_WITHOUT_MENU which might be what you want. However, if the Action product is in the class path, we have to keep current behavior to make that product work correctly. You could also invoke LookAndFeelFactory#setDefaultStyle() to alter the default behavior.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 10 guests

cron