And on we go with fixing the BasicTabbedPaneUI. This patch fixes the
layout of the tabs a little more:

2006-03-20  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicTabbedPaneUI.java
        (calculateTabHeight): Not need to use SwingUtilities here.
        (getTabInsets): Do not rotate insets.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.35
diff -u -r1.35 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java	20 Mar 2006 11:42:11 -0000	1.35
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java	20 Mar 2006 14:07:41 -0000
@@ -2601,24 +2601,14 @@
   protected int calculateTabHeight(int tabPlacement, int tabIndex,
                                    int fontHeight)
   {
-    Icon icon = getIconForTab(tabIndex);
-    Insets insets = getTabInsets(tabPlacement, tabIndex);
+    // FIXME: Handle HTML somehow.
 
-    int height = 0;
+    int height = fontHeight;
+    Icon icon = getIconForTab(tabIndex);
+    Insets tabInsets = getTabInsets(tabPlacement, tabIndex);
     if (icon != null)
-      {
-        Rectangle vr = new Rectangle();
-        Rectangle ir = new Rectangle();
-        Rectangle tr = new Rectangle();
-        layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
-                    tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
-                    tabIndex == tabPane.getSelectedIndex());
-        height = tr.union(ir).height;
-      }
-    else
-      height = fontHeight;
-
-    height += insets.top + insets.bottom;
+      height = Math.max(height, icon.getIconHeight());
+    height += tabInsets.top + tabInsets.bottom + 2;
     return height;
   }
 
@@ -2751,9 +2741,7 @@
    */
   protected Insets getTabInsets(int tabPlacement, int tabIndex)
   {
-    Insets target = new Insets(0, 0, 0, 0);
-    rotateInsets(tabInsets, target, tabPlacement);
-    return target;
+    return tabInsets;
   }
 
   /**

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to