Skip to content
Snippets Groups Projects
Commit 8794e1b9 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

DEFAULT_BACKGROUND is now public + minor corrections

parent cce12d72
No related branches found
No related tags found
No related merge requests found
......@@ -35,9 +35,9 @@ import fr.soleil.lib.project.awt.ColorUtils;
*/
public class ArrowButton extends JButton implements MouseListener {
private static final long serialVersionUID = 5437073960702647214L;
private static final long serialVersionUID = -1363309152147062372L;
protected static final Color DEFAULT_BACKGROUND = new Color(102, 102, 153);
public static final Color DEFAULT_BACKGROUND = new Color(102, 102, 153);
public static final int DEFAULT_SIZE = 5;
protected static final double BRIGHTNESS_FACTOR = 0.3;
protected static final double STATE_FACTOR = 0.2;
......@@ -54,7 +54,6 @@ public class ArrowButton extends JButton implements MouseListener {
private int orientation;
private Color lightColor;
private Color darkColor;
private volatile boolean mouseOver;
public ArrowButton() {
this(UP);
......@@ -116,15 +115,17 @@ public class ArrowButton extends JButton implements MouseListener {
@Override
public void mouseEntered(MouseEvent e) {
mouseOver = true;
if (isEnabled()) {
getModel().setRollover(true);
repaint();
}
}
@Override
public void mouseExited(MouseEvent e) {
mouseOver = false;
if (getModel().isRollover()) {
getModel().setRollover(false);
}
if (isEnabled()) {
repaint();
}
......@@ -208,7 +209,7 @@ public class ArrowButton extends JButton implements MouseListener {
* @return Whether mouse is over this {@link ArrowButton}
*/
protected boolean isMouseOver() {
return mouseOver;
return getModel().isRollover();
}
@Override
......@@ -389,7 +390,8 @@ public class ArrowButton extends JButton implements MouseListener {
JFrame testFrame = new JFrame(ArrowButton.class.getSimpleName() + " test");
testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
testFrame.setContentPane(panel);
testFrame.setSize(300, 80);
testFrame.pack();
testFrame.setSize(300, testFrame.getHeight());
testFrame.setVisible(true);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment