MenuItem Icon Alignment Problems

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.

MenuItem Icon Alignment Problems

Postby rwhittak3 » Mon Jun 15, 2009 4:11 pm

I have a menu that has 2 items, a normal menu item, and a submenu (JMenu). Both the menu item and the submenu have icons. When I apply the Jide extensions, the icons fail to line up. Here is some sample code.

Code: Select all
import com.jidesoft.plaf.LookAndFeelFactory;
import javax.swing.*;

public class MenuItemIconAlignmentTest extends JFrame {
    public MenuItemIconAlignmentTest() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            LookAndFeelFactory.installJideExtension();

        } catch (Exception e) {
            e.printStackTrace();
        }

        JMenuBar bar = new JMenuBar();
        JMenu menu = new JMenu("Menu Bar");

        JMenuItem item = new JMenuItem("Menu Item");
        item.setIcon(new ImageIcon("green_circle.png"));

        JMenu submenu = new JMenu("Submenu");
        submenu.add(new JMenuItem("Submenu Item"));
        submenu.setIcon(new ImageIcon("green_circle.png"));

        menu.add(item);
        menu.add(submenu);
        bar.add(menu);

        setJMenuBar(bar);

        setSize(200,200);
        setVisible(true);
    }

    public static void main(String a[]) {
        new MenuItemIconAlignmentTest();
    }
}


When I run it, I get something that looks like this:

Image

You can see that the submenu's icon offset to the right, butting up against the edge of the sidebar. Is there something I can do to line those icons up properly?

Thanks in advance for any help or advice!

Richard
rwhittak3
 
Posts: 4
Joined: Mon Jun 15, 2009 3:53 pm

Re: MenuItem Icon Alignment Problems

Postby JIDE Support » Mon Jun 15, 2009 6:21 pm

It's weird. I cannot reproduce the issue you mentioned. Since I don't have the img file, the img icon is the only place I changed from your test case.

Code: Select all
import com.jidesoft.plaf.LookAndFeelFactory;
import javax.swing.*;

public class MenuItemIconAlignmentTest extends JFrame {
    public MenuItemIconAlignmentTest() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            LookAndFeelFactory.installJideExtension();

        } catch (Exception e) {
            e.printStackTrace();
        }

        JMenuBar bar = new JMenuBar();
        JMenu menu = new JMenu("Menu Bar");

        JMenuItem item = new JMenuItem("Menu Item");
        item.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.RENAME));

        JMenu submenu = new JMenu("Submenu");
        submenu.add(new JMenuItem("Submenu Item"));
        submenu.setIcon(ButtonsIconsFactory.getImageIcon(ButtonsIconsFactory.Buttons.RENAME));

        menu.add(item);
        menu.add(submenu);
        bar.add(menu);

        setJMenuBar(bar);

        setSize(200,200);
        setVisible(true);
    }

    public static void main(String a[]) {
        new MenuItemIconAlignmentTest();
    }
}


Below is the screen shot.
screeshot.png
screeshot.png (13.46 KiB) Viewed 41661 times


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

Re: MenuItem Icon Alignment Problems

Postby rwhittak3 » Tue Jun 16, 2009 8:29 am

Huh, that is weird. I didn't think the image would be the difference, but perhaps it is.

Anyways, if you could try it with my image, that would be great!

[download link removed]

Thank you for looking at this issue.

Richard
Last edited by rwhittak3 on Tue Jun 16, 2009 9:01 am, edited 2 times in total.
rwhittak3
 
Posts: 4
Joined: Mon Jun 15, 2009 3:53 pm

Re: MenuItem Icon Alignment Problems

Postby rwhittak3 » Tue Jun 16, 2009 8:32 am

Oh, also, I should mention that I'm running on Windows XP.
rwhittak3
 
Posts: 4
Joined: Mon Jun 15, 2009 3:53 pm

Re: MenuItem Icon Alignment Problems

Postby JIDE Support » Tue Jun 16, 2009 8:32 am

I guess maybe the release did the trick. We checked the history and looks like one fix in 2.6.6 could have fixed the issue. Would you please give our latest 2.6.6 a try?

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

Re: MenuItem Icon Alignment Problems

Postby rwhittak3 » Tue Jun 16, 2009 9:00 am

The icons line up properly with the latest version. Thank you very much for looking into it!
rwhittak3
 
Posts: 4
Joined: Mon Jun 15, 2009 3:53 pm

Re: MenuItem Icon Alignment Problems

Postby EikeB » Tue Jun 23, 2009 8:43 am

Hi,

it seems to me, that i have a similar problem with the Swing menu items.

I build a GUI with Netbeans with some JMenus and JMenuItems.
menu1.jpg
menu1.jpg (11.8 KiB) Viewed 41643 times

(This is a screenshot how it looks like before executing any jide stuff)

In another FrameI use the ListDataIntelliHints, here is the code:

Code: Select all
intellihints = new ListDataIntelliHints(programNumber, ProgramManager.getProgramList("",""));
intellihints.setCaseSensitive(false);

(programNumber is a JTextfield)

After executing these two lines the appearance of all my JMenus change somehow. (in all Frames)
I used jide-oss-2.5.8:
menu3.jpg
menu3.jpg (10.12 KiB) Viewed 41643 times


With upgrading to version 2.6.6:
menu2.jpg
menu2.jpg (10.39 KiB) Viewed 41643 times


Any suggestions how to solve this problem?
EikeB
 
Posts: 3
Joined: Tue Jun 23, 2009 5:08 am

Re: MenuItem Icon Alignment Problems

Postby JIDE Support » Tue Jun 23, 2009 8:59 am

Please try invoke LookAndFeelFactory.installJideExtension( LookAndFeelFactory.VSNET_STYLE_WITHOUT_MENU) explicitly before you invoke the two line of codes and see if it solves your issue.

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

Re: MenuItem Icon Alignment Problems

Postby JIDE Support » Tue Jun 23, 2009 10:07 am

It would be great if we can have a test case from you regarding this issue. We don't expect to impact the icon display anyway even you install the entire look and feel.

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

Re: MenuItem Icon Alignment Problems

Postby EikeB » Tue Jun 23, 2009 12:43 pm

I just uploaded a small program that shows the "bug".

But adding the line:
Code: Select all
LookAndFeelFactory.installJideExtension( LookAndFeelFactory.VSNET_STYLE_WITHOUT_MENU);

has solved the problem.
Thanks :)
Attachments
IntelliTestCase.zip
(146.3 KiB) Downloaded 1854 times
EikeB
 
Posts: 3
Joined: Tue Jun 23, 2009 5:08 am

Re: MenuItem Icon Alignment Problems

Postby JIDE Support » Tue Jun 23, 2009 1:20 pm

Thanks for your attempt to share. However, we do need source code when we talk about test cases so that we can debug it. The code fraction that could demonstrate how you create the menu items would be good enough.

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

Re: MenuItem Icon Alignment Problems

Postby EikeB » Tue Jun 23, 2009 2:42 pm

Sry, thougt i uploaded the sourcecode... here is it ;)

Its just the source, I couldnt upload the whole project, filesize was greater than 256k :?
Attachments
IntelliTestCase_src.zip
(99.63 KiB) Downloaded 1835 times
EikeB
 
Posts: 3
Joined: Tue Jun 23, 2009 5:08 am


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

Who is online

Users browsing this forum: No registered users and 41 guests