I added support for the tabsOpaque UIManager property to the
BasicTabbedPane. This property causes the tab background (note:  not the
whole JTabbedPane!) to be painted or not, depending on the value.

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

        * javax/swing/plaf/basic/BasicTabbedPaneUI.java
        (tabsOpaque): New field.
        (installDefaults): Fetch tabsOpaque property from UIManager.
        (paintTab): Fill tab background when tabsOpaque property is
true.
        * javax/swing/plaf/basic/BasicLookAndFeel.java
        (initComponentDefaults): Added TabbedPane.tabsOpaque property.

/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.38
diff -u -r1.38 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java	20 Mar 2006 19:29:17 -0000	1.38
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java	20 Mar 2006 21:51:09 -0000
@@ -1403,6 +1403,12 @@
   private int rolloverTab;
 
   /**
+   * Determines if tabs are painted opaque or not. This can be adjusted using
+   * the UIManager property 'TabbedPane.tabsOpaque'.
+   */
+  private boolean tabsOpaque;
+
+  /**
    * Creates a new BasicTabbedPaneUI object.
    */
   public BasicTabbedPaneUI()
@@ -1617,6 +1623,7 @@
     selectedTabPadInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabPadInsets");
     tabAreaInsets = UIManager.getInsets("TabbedPane.tabAreaInsets");
     contentBorderInsets = UIManager.getInsets("TabbedPane.tabbedPaneContentBorderInsets");
+    tabsOpaque = UIManager.getBoolean("TabbedPane.tabsOpaque");
 
     calcRect = new Rectangle();
     tabRuns = new int[10];
@@ -1838,7 +1845,7 @@
     Rectangle rect = rects[tabIndex];
     boolean isSelected = tabIndex == tabPane.getSelectedIndex();
     // Paint background if necessary.
-    if (tabPane.isOpaque())
+    if (tabsOpaque || tabPane.isOpaque())
       {
         paintTabBackground(g, tabPlacement, tabIndex, rect.x, rect.y,
                            rect.width, rect.height, isSelected);
Index: javax/swing/plaf/basic/BasicLookAndFeel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v
retrieving revision 1.87
diff -u -r1.87 BasicLookAndFeel.java
--- javax/swing/plaf/basic/BasicLookAndFeel.java	18 Mar 2006 13:42:03 -0000	1.87
+++ javax/swing/plaf/basic/BasicLookAndFeel.java	20 Mar 2006 21:51:10 -0000
@@ -1114,6 +1114,7 @@
       "TabbedPane.shadow", new ColorUIResource(shadow),
       "TabbedPane.tabbedPaneContentBorderInsets", new InsetsUIResource(3, 2, 1, 2),
       "TabbedPane.tabbedPaneTabPadInsets", new InsetsUIResource(1, 1, 1, 1),
+      "TabbedPane.tabsOpaque", Boolean.TRUE,
       "TabbedPane.tabAreaInsets", new InsetsUIResource(3, 2, 0, 2),
       "TabbedPane.tabInsets", new InsetsUIResource(0, 4, 1, 4),
       "TabbedPane.tabRunOverlay", new Integer(2),

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

Reply via email to