Skip to content

Commit

Permalink
Fixed some issue
Browse files Browse the repository at this point in the history
- Attending test atarw/material-ui-swing#75
- Attending test atarw/material-ui-swing#74
- Attending Test atarw/material-ui-swing#73
- Ateending test atarw/material-ui-swing#72
  • Loading branch information
vincenzopalazzo committed Mar 28, 2019
1 parent 9c8b46c commit 790b13d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/MaterialUISwingDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 6 additions & 3 deletions src/mdlaf/components/button/MaterialButtonUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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
Expand All @@ -55,4 +56,6 @@ public void update(Graphics g, JComponent c) {
super.update(g, c);
c.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}


}
5 changes: 3 additions & 2 deletions src/mdlaf/components/menu/MaterialMenuUI.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 790b13d

Please sign in to comment.