* hard-code highlight colors
This commit is contained in:
parent
a8bec2fb09
commit
bf6cccfbbb
|
@ -5,7 +5,6 @@ package net.sourceforge.tuned.ui;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.awt.SystemColor;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
@ -23,14 +22,14 @@ import javax.swing.JButton;
|
||||||
public class LinkButton extends JButton {
|
public class LinkButton extends JButton {
|
||||||
|
|
||||||
private Color color = getForeground();
|
private Color color = getForeground();
|
||||||
private Color rolloverColor = SystemColor.textHighlight;
|
private Color rolloverColor = new Color(0x3399FF);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LinkButton(String text, Icon icon, URI uri) {
|
public LinkButton(String text, Icon icon, URI uri) {
|
||||||
this(new OpenUriAction(text, icon, uri));
|
this(new OpenUriAction(text, icon, uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LinkButton(Action action) {
|
public LinkButton(Action action) {
|
||||||
setAction(action);
|
setAction(action);
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ public class LinkButton extends JButton {
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRolloverEnabled(boolean enabled) {
|
public void setRolloverEnabled(boolean enabled) {
|
||||||
super.setRolloverEnabled(enabled);
|
super.setRolloverEnabled(enabled);
|
||||||
|
@ -60,28 +59,27 @@ public class LinkButton extends JButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setColor(Color color) {
|
public void setColor(Color color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.setForeground(color);
|
this.setForeground(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Color getRolloverColor() {
|
public Color getRolloverColor() {
|
||||||
return rolloverColor;
|
return rolloverColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setRolloverColor(Color rolloverColor) {
|
public void setRolloverColor(Color rolloverColor) {
|
||||||
this.rolloverColor = rolloverColor;
|
this.rolloverColor = rolloverColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected final MouseListener rolloverListener = new MouseAdapter() {
|
protected final MouseListener rolloverListener = new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -89,25 +87,25 @@ public class LinkButton extends JButton {
|
||||||
setForeground(rolloverColor);
|
setForeground(rolloverColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
setForeground(color);
|
setForeground(color);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
protected static class OpenUriAction extends AbstractAction {
|
protected static class OpenUriAction extends AbstractAction {
|
||||||
|
|
||||||
public static final String URI = "uri";
|
public static final String URI = "uri";
|
||||||
|
|
||||||
|
|
||||||
public OpenUriAction(String text, Icon icon, URI uri) {
|
public OpenUriAction(String text, Icon icon, URI uri) {
|
||||||
super(text, icon);
|
super(text, icon);
|
||||||
putValue(URI, uri);
|
putValue(URI, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue