Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / October 2006

Tip: Looking for answers? Try searching our database.

space to the left of JMenuItem

Thread view: 
nathan.sweet@gmail.com - 28 Sep 2006 18:54 GMT
This post would have saved me time, so I'm posting it here to save
others time.

The problem is the JMenuItem has space to the left of icon. It does
this to make room for a checkbox, but when none of the items have a
checkbox it looks bad. Here is the bug...

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4199382

Here is a fix for Sun's winlaf...

JMenuItem menuItem = new  JMenuItem("blah");
menuItem.setUI(new WindowsMenuItemUI() {
    protected void paintMenuItem (Graphics g, JComponent c, Icon
checkIcon, Icon arrowIcon, Color background,
        Color foreground, int defaultTextIconGap) {
        super.paintMenuItem(g, c, null, arrowIcon, background, foreground,
0);
    }

    protected void paintText (Graphics g, JMenuItem menuItem, Rectangle
textRect, String text) {
        textRect.x += 6;
        super.paintText(g, menuItem, textRect, text);
    }
});
TestMan - 31 Oct 2006 08:15 GMT
nathan.sweet@gmail.com a écrit :
> This post would have saved me time, so I'm posting it here to save
> others time.
[quoted text clipped - 22 lines]
>     }
> });

You could have tried to use WinLaF UI directly ...
https://winlaf.dev.java.net/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.