diff --git a/src/main/java/mdlaf/MaterialLookAndFeel.java b/src/main/java/mdlaf/MaterialLookAndFeel.java index ae2c9fb..82229b2 100644 --- a/src/main/java/mdlaf/MaterialLookAndFeel.java +++ b/src/main/java/mdlaf/MaterialLookAndFeel.java @@ -509,13 +509,14 @@ protected void initComponentDefaults(UIDefaults table) { table.put("ToolBar.font", theme.getFontRegular()); table.put("ToolBar.background", theme.getBackgroundPrimary()); - table.put("ToolBar.dockingForeground", theme.getBackgroundPrimary()); table.put("ToolBar.foreground", theme.getTextColor()); table.put("ToolBar.border", theme.getBorderToolBar()); table.put("ToolBar.rolloverBorder", new BorderUIResource(BorderFactory.createEmptyBorder(5,5,5,5))); - table.put("ToolBar.dockingBackground", theme.getDockingBackgroundToolBar()); - table.put("ToolBar.floatingBackground", theme.getFloatingBackgroundToolBar()); - table.put("ToolBar[button].mouseHover", theme.getMouseHoverButtonEnable()); + table.put("ToolBar.dockingBackground", theme.getBackgroundPrimary()); + table.put("ToolBar.floatingBackground", theme.getBackgroundPrimary()); + table.put("ToolBar.dockingForeground", theme.getTextColor()); + table.put("ToolBar.floatingForeground", theme.getTextColor()); + table.put("ToolBar[button].mouseHover", false); table.put("Tree.font", theme.getFontRegular()); table.put("Tree.selectionForeground", theme.getHighlightBackgroundPrimary()); diff --git a/src/main/java/mdlaf/components/button/MaterialButtonUI.java b/src/main/java/mdlaf/components/button/MaterialButtonUI.java index 625ffec..e2c04f6 100644 --- a/src/main/java/mdlaf/components/button/MaterialButtonUI.java +++ b/src/main/java/mdlaf/components/button/MaterialButtonUI.java @@ -215,7 +215,7 @@ public void update(Graphics g, JComponent c) { @Override protected void paintButtonPressed(Graphics g, AbstractButton b) { //if the mouse hover is enabled I can set the mouse hover color when the button is pressed - if (mouseHoverEnabled) { + if (mouseHoverEnabled && b.getModel().isPressed()) { if (b.isEnabled()) { if (this.isDefaultButton()) { g.setColor(colorMouseHoverDefaultButton); diff --git a/src/main/java/mdlaf/components/toolbar/MaterialToolBarUI.java b/src/main/java/mdlaf/components/toolbar/MaterialToolBarUI.java index f7de749..039219f 100644 --- a/src/main/java/mdlaf/components/toolbar/MaterialToolBarUI.java +++ b/src/main/java/mdlaf/components/toolbar/MaterialToolBarUI.java @@ -28,6 +28,8 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicToolBarUI; import java.awt.*; +import java.awt.event.ContainerEvent; +import java.awt.event.ContainerListener; /** * @author https://github.com/vincenzopalazzo @@ -55,6 +57,29 @@ public void uninstallUI(JComponent c) { super.uninstallUI(c); } + @Override + protected ContainerListener createToolBarContListener() { + return new ToolBarContListener() { + @Override + public void componentAdded( ContainerEvent e ) { + super.componentAdded( e ); + + Component c = e.getChild(); + if( c instanceof AbstractButton ) + c.setFocusable( false ); + } + + @Override + public void componentRemoved( ContainerEvent e ) { + super.componentRemoved( e ); + + Component c = e.getChild(); + if( c instanceof AbstractButton ) + c.setFocusable( true ); + } + }; + } + @Override protected void setBorderToRollover( Component c ) {} @@ -78,5 +103,4 @@ protected void installNormalBorders( JComponent c ) {} @Override protected Border createNonRolloverBorder() { return null; } - } diff --git a/src/main/java/mdlaf/themes/AbstractMaterialTheme.java b/src/main/java/mdlaf/themes/AbstractMaterialTheme.java index 9260946..2066aa0 100644 --- a/src/main/java/mdlaf/themes/AbstractMaterialTheme.java +++ b/src/main/java/mdlaf/themes/AbstractMaterialTheme.java @@ -511,6 +511,9 @@ protected void installDefaultColor(){ this.foregroundToolTip = textColor; this.disabledColorSlider = buttonDisabledBackground; + + this.dockingBackgroundToolBar = this.backgroundPrimary; + this.floatingBackgroundToolBar = this.textColor; } protected void installFonts() { diff --git a/src/main/java/mdlaf/themes/JMarsDarkTheme.java b/src/main/java/mdlaf/themes/JMarsDarkTheme.java index 22afd05..c48d38d 100644 --- a/src/main/java/mdlaf/themes/JMarsDarkTheme.java +++ b/src/main/java/mdlaf/themes/JMarsDarkTheme.java @@ -132,9 +132,6 @@ protected void installColor() { this.gridColorTable = new ColorUIResource(151,151,151); this.alternateRowBackgroundTable = new ColorUIResource(59, 62, 69); - this.dockingBackgroundToolBar = MaterialColors.LIGHT_GREEN_A100; - this.floatingBackgroundToolBar = MaterialColors.GRAY_200; - this.backgroundTextField = new ColorUIResource(81, 86, 101); this.inactiveForegroundTextField = MaterialColors.WHITE; this.inactiveBackgroundTextField = new ColorUIResource(81, 86, 101); diff --git a/src/main/java/mdlaf/themes/MaterialLiteTheme.java b/src/main/java/mdlaf/themes/MaterialLiteTheme.java index bd36a19..72dc9fe 100644 --- a/src/main/java/mdlaf/themes/MaterialLiteTheme.java +++ b/src/main/java/mdlaf/themes/MaterialLiteTheme.java @@ -103,9 +103,6 @@ protected void installColor() { this.gridColorTable = MaterialColors.GRAY_200; this.alternateRowBackgroundTable = MaterialColors.GRAY_300; - this.dockingBackgroundToolBar = MaterialColors.LIGHT_GREEN_A100; - this.floatingBackgroundToolBar = MaterialColors.GRAY_200; - this.backgroundTextField = MaterialColors.GRAY_200; this.inactiveForegroundTextField = MaterialColors.GRAY_800; this.inactiveBackgroundTextField = MaterialColors.GRAY_200; diff --git a/src/main/java/mdlaf/themes/MaterialOceanicTheme.java b/src/main/java/mdlaf/themes/MaterialOceanicTheme.java index 0a8d672..58f5969 100644 --- a/src/main/java/mdlaf/themes/MaterialOceanicTheme.java +++ b/src/main/java/mdlaf/themes/MaterialOceanicTheme.java @@ -148,9 +148,6 @@ protected void installColor() { this.gridColorTable = MaterialColors.COSMO_BLACK; this.alternateRowBackgroundTable = MaterialColors.DARKLY_STRONG_BLUE; - this.dockingBackgroundToolBar = MaterialColors.LIGHT_GREEN_A100; - this.floatingBackgroundToolBar = MaterialColors.GRAY_200; - this.backgroundTextField = MaterialColors.DARKLY_BLUE; this.inactiveForegroundTextField = MaterialColors.WHITE; this.inactiveBackgroundTextField = MaterialColors.DARKLY_BLUE;