Mercurial > hg > release > thermostat-0.4
changeset 345:e594a4b7e74f
more UI cleanup (1)
reviewed-by: rkennke
review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-May/001646.html
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Thu, 31 May 2012 21:44:14 +0200 |
parents | c3bdbbdc6b16 |
children | 7fec2d52f278 |
files | dolphin/src/main/java/com/redhat/swing/laf/dolphin/tab/DolphinTabbedPaneUI.java dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java |
diffstat | 2 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dolphin/src/main/java/com/redhat/swing/laf/dolphin/tab/DolphinTabbedPaneUI.java Thu May 31 21:44:14 2012 +0200 +++ b/dolphin/src/main/java/com/redhat/swing/laf/dolphin/tab/DolphinTabbedPaneUI.java Thu May 31 21:44:14 2012 +0200 @@ -45,6 +45,7 @@ import java.awt.geom.GeneralPath; import javax.swing.JComponent; +import javax.swing.JTabbedPane; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.metal.MetalTabbedPaneUI; @@ -53,6 +54,11 @@ public class DolphinTabbedPaneUI extends MetalTabbedPaneUI { + private static final boolean keepBG; + static { + keepBG = DolphinThemeUtils.getCurrentTheme().getTabPaneKeepBackgroundColor(); + } + private static final int MAGIC_NUMBER = 3; public static ComponentUI createUI(JComponent tabPane) { @@ -75,6 +81,25 @@ return tab; } + private boolean bgSet; + @Override + public void paint(Graphics g, JComponent c) { + if (!keepBG && !bgSet) { + if (c instanceof JTabbedPane) { + // well, who else... + JTabbedPane tabPane = (JTabbedPane) c; + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + for (int i = 0; i < tabPane.getComponentCount(); i++) { + tabPane.getComponent(i).setBackground(theme.getTabAreaBackground()); + } + bgSet = true; + } + } + super.paint(g, c); + } + @Override protected void paintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
--- a/dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java Thu May 31 21:44:14 2012 +0200 +++ b/dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java Thu May 31 21:44:14 2012 +0200 @@ -82,6 +82,14 @@ System.setProperty("dolphin.tree.nofill", String.valueOf(value)); } + public boolean getTabPaneKeepBackgroundColor() { + return Boolean.getBoolean("dolphin.tab.keepbg"); + } + + public void setTabPaneKeepBackgroundColor(boolean value) { + System.setProperty("dolphin.tab.keepbg", String.valueOf(value)); + } + public abstract ColorUIResource getwindowBackgroundColor(); public abstract ColorUIResource getMenuBackgroundColor();