From 790b13d109bdb8b9a9ccb641c0c958a354ec8a11 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Thu, 28 Mar 2019 23:21:10 +0100 Subject: [PATCH] Fixed some issue - Attending test https://github.com/atarw/material-ui-swing/issues/75 - Attending test https://github.com/atarw/material-ui-swing/issues/74 - Attending Test https://github.com/atarw/material-ui-swing/issues/73 - Ateending test https://github.com/atarw/material-ui-swing/issues/72 --- src/MaterialUISwingDemo.java | 3 ++- src/mdlaf/components/button/MaterialButtonUI.java | 9 ++++++--- src/mdlaf/components/menu/MaterialMenuUI.java | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/MaterialUISwingDemo.java b/src/MaterialUISwingDemo.java index 526bed8..507fe46 100644 --- a/src/MaterialUISwingDemo.java +++ b/src/MaterialUISwingDemo.java @@ -245,7 +245,7 @@ public void actionPerformed(ActionEvent e) { JXTaskPane jxTaskPane = new JXTaskPane(); jxTaskPane.setTitle("Material UI memory"); - + jxTaskPane.setOpaque(false); JLabel memoryOccupedNow = new JLabel(); @@ -345,6 +345,7 @@ public void actionPerformed(ActionEvent e) { buttonQuestion.setAction(new QuesuionMessage()); JButton buttonWarning = new JButton(); + buttonWarning.setOpaque(false); buttonWarning.setBackground(MaterialColors.YELLOW_800); buttonWarning.addMouseListener(MaterialUIMovement.getMovement(buttonWarning, MaterialColors.YELLOW_500)); class WarningMessage extends AbstractAction { diff --git a/src/mdlaf/components/button/MaterialButtonUI.java b/src/mdlaf/components/button/MaterialButtonUI.java index 1fdb87e..686a6c4 100644 --- a/src/mdlaf/components/button/MaterialButtonUI.java +++ b/src/mdlaf/components/button/MaterialButtonUI.java @@ -8,7 +8,6 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; -import java.util.Map; public class MaterialButtonUI extends BasicButtonUI { @@ -35,14 +34,16 @@ public void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; g = MaterialDrawingUtils.getAliasedGraphics(g); if (b.isContentAreaFilled()) { - paintBackground(g, b); + paintBackground(MaterialDrawingUtils.getAliasedGraphics(g), b); } - super.paint(g, c); + super.paint(MaterialDrawingUtils.getAliasedGraphics(g), c); } private void paintBackground(Graphics g, JComponent c) { + g = MaterialDrawingUtils.getAliasedGraphics(g); g.setColor(c.getBackground()); g.fillRoundRect(0, 0, c.getWidth(), c.getHeight(), 7, 7); + } @Override @@ -55,4 +56,6 @@ public void update(Graphics g, JComponent c) { super.update(g, c); c.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } + + } \ No newline at end of file diff --git a/src/mdlaf/components/menu/MaterialMenuUI.java b/src/mdlaf/components/menu/MaterialMenuUI.java index 63296df..5580830 100644 --- a/src/mdlaf/components/menu/MaterialMenuUI.java +++ b/src/mdlaf/components/menu/MaterialMenuUI.java @@ -1,7 +1,6 @@ package mdlaf.components.menu; import mdlaf.animation.MaterialUIMovement; -import mdlaf.utils.MaterialColors; import mdlaf.utils.MaterialDrawingUtils; import javax.swing.*; import javax.swing.event.ChangeListener; @@ -46,7 +45,9 @@ public void paint (Graphics g, JComponent c) { @Override protected ChangeListener createChangeListener(JComponent c) { - c.addMouseListener(new MouseHover()); + if(UIManager.getBoolean("Menu[MouseOver].enable")){ //TODO Testing + c.addMouseListener(new MouseHover()); + } return super.createChangeListener(c); }