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/