space to the left of JMenuItem
- From: nathan.sweet@xxxxxxxxx
- Date: 28 Sep 2006 10:54:58 -0700
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);
}
});
.
- Prev by Date: Re: Web safe colours only?
- Next by Date: Re: TreePath
- Previous by thread: Web safe colours only?
- Index(es):