As mentioned in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27196
the tabs are not rendered correctly when disabled. This is fixed by this
patch.
2006-04-20 Roman Kennke <[EMAIL PROTECTED]>
PR 27196
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(paintText): Fetch the ascent only once. Add the ascent to
the text rect also when tabs are disabled.
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.41
diff -u -1 -0 -r1.41 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java 17 Apr 2006 07:41:05 -0000 1.41
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java 20 Apr 2006 09:53:31 -0000
@@ -1947,58 +1947,61 @@
Rectangle textRect, boolean isSelected)
{
g.setFont(font);
View textView = getTextViewForTab(tabIndex);
if (textView != null)
{
textView.paint(g, textRect);
return;
}
+ int ascent = metrics.getAscent();
+
int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex))
{
Color fg = tabPane.getForegroundAt(tabIndex);
if (isSelected && (fg instanceof UIResource))
{
Color selectionForeground =
UIManager.getColor("TabbedPane.selectionForeground");
if (selectionForeground != null)
fg = selectionForeground;
}
g.setColor(fg);
if (mnemIndex != -1)
BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
textRect.x,
- textRect.y
- + metrics.getAscent());
+ textRect.y + ascent);
else
- g.drawString(title, textRect.x, textRect.y + metrics.getAscent());
+ g.drawString(title, textRect.x, textRect.y + ascent);
}
else
{
Color bg = tabPane.getBackgroundAt(tabIndex);
g.setColor(bg.brighter());
if (mnemIndex != -1)
BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
- textRect.x, textRect.y);
+ textRect.x, textRect.y
+ + ascent);
else
- g.drawString(title, textRect.x, textRect.y);
+ g.drawString(title, textRect.x, textRect.y + ascent);
g.setColor(bg.darker());
if (mnemIndex != -1)
BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
textRect.x + 1,
- textRect.y + 1);
+ textRect.y + 1
+ + ascent);
else
- g.drawString(title, textRect.x + 1, textRect.y + 1);
+ g.drawString(title, textRect.x + 1, textRect.y + 1 + ascent);
}
}
/**
* This method returns how much the label for the tab should shift in the X
* direction.
*
* @param tabPlacement The JTabbedPane's tab placement.
* @param tabIndex The tab index being painted.
* @param isSelected Whether this tab is selected.