I fixed the MetalTabbedPaneUI to correctly respect the tabsOpaque UI property.
2006-03-28 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/plaf/metal/MetalTabbedPaneUI.java (tabsOpaque): New field. (paintLeftTabBorder): Paint some parts only when the tabs are opaque. Determine the tab background using the paintLeftTabBorder() helper method. (paintRightTabBorder): Likewise. (installDefaults): Fetch tabsOpaque property from the UIDefaults. /Roman -- “Improvement makes straight roads, but the crooked roads, without Improvement, are roads of Genius.” - William Blake
Index: javax/swing/plaf/metal/MetalTabbedPaneUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java,v retrieving revision 1.18 diff -u -1 -0 -r1.18 MetalTabbedPaneUI.java --- javax/swing/plaf/metal/MetalTabbedPaneUI.java 23 Mar 2006 15:37:05 -0000 1.18 +++ javax/swing/plaf/metal/MetalTabbedPaneUI.java 28 Mar 2006 09:47:07 -0000 @@ -130,21 +130,26 @@ */ protected Color selectHighlight; /** * The background color used for the tab area. */ protected Color tabAreaBackground; /** The graphics to draw the highlight below the tab. */ private Graphics hg; - + + /** + * Indicates if the tabs are having their background filled. + */ + private boolean tabsOpaque; + /** * Constructs a new instance of MetalTabbedPaneUI. */ public MetalTabbedPaneUI() { super(); } /** * Returns an instance of MetalTabbedPaneUI. @@ -320,27 +325,27 @@ g.translate(x, y); int bottom = h - 1; int right = w - 1; int tabCount = tabPane.getTabCount(); int currentRun = getRunForTab(tabCount, tabIndex); int firstIndex = tabRuns[currentRun]; // Paint the part of the above tab. - if (tabIndex != firstIndex) + if (tabIndex != firstIndex && tabIndex > 0 && tabsOpaque) { Color c; if (tabPane.getSelectedIndex() == tabIndex - 1) c = selectColor; else - c = UIManager.getColor("TabbedPane.unselectedBackground"); + c = getUnselectedBackground(tabIndex - 1); g.setColor(c); g.fillRect(2, 0, 4, 3); g.drawLine(2, 3, 2, 3); } // Paint the highlight. boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme; if (isOcean) { g.setColor(isSelected ? selectHighlight : MetalLookAndFeel.getWhite()); @@ -447,27 +452,27 @@ { g.translate(x, y); int bottom = h - 1; int right = w - 1; int tabCount = tabPane.getTabCount(); int currentRun = getRunForTab(tabCount, tabIndex); int firstIndex = tabRuns[currentRun]; // Paint part of the above tab. - if (tabIndex != firstIndex) + if (tabIndex != firstIndex && tabIndex > 0 && tabsOpaque) { Color c; if (tabPane.getSelectedIndex() == tabIndex - 1) c = UIManager.getColor("TabbedPane.tabAreaBackground"); else - c = UIManager.getColor("TabbedPane.unselectedBackground"); + c = getUnselectedBackground(tabIndex - 1); g.fillRect(right - 5, 0, 5, 3); g.fillRect(right - 2, 3, 2, 2); } // Paint highlight. g.setColor(isSelected ? selectHighlight : highlight); // Slant. g.drawLine(right - 6, 1, right - 1, 6); // Top. @@ -702,20 +707,21 @@ /** * Installs the defaults for this UI. This method calls super.installDefaults * and then loads the Metal specific defaults for TabbedPane. */ protected void installDefaults() { super.installDefaults(); selectColor = UIManager.getColor("TabbedPane.selected"); selectHighlight = UIManager.getColor("TabbedPane.selectHighlight"); tabAreaBackground = UIManager.getColor("TabbedPane.tabAreaBackground"); + tabsOpaque = UIManager.getBoolean("TabbedPane.tabsOpaque"); minTabWidth = 0; } /** * Returns the color for the gap. * * @param currentRun - The current run to return the color for * @param x - The x position of the current run * @param y - The y position of the current run *