package rapanui.ui.controls;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;

import javax.swing.JButton;

public class SimpleLink extends JButton {
	private static final long serialVersionUID = 1L;

	private static final Color defaultColor = new Color(0x000099);
	private static final Color hoverColor = Color.ORANGE;

	public SimpleLink(String text, String tooltip, ActionListener action) {
		this(text, tooltip);
		addActionListener(action);
	}

	public SimpleLink(String text, String tooltip) {
		setText(text);
		setToolTipText(tooltip);

		// styling
		setMargin(new Insets(0,0,0,0));
		setBorderPainted(false);
		setOpaque(false);
		setContentAreaFilled(false);
		setFont(getFont().deriveFont(20f));
		setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
		setForeground(defaultColor);
	}

	@Override
	public Dimension getMaximumSize() {
		return getMinimumSize();
	}

	@Override
	public void processMouseEvent(MouseEvent e) {
		switch (e.getID()) {
		case MouseEvent.MOUSE_ENTERED:
			setForeground(hoverColor);
			break;
		case MouseEvent.MOUSE_EXITED:
			setForeground(defaultColor);
			break;
		}
		super.processMouseEvent(e);
	}
}

@@ -194,16 +194,43 @@
 Event;%0A%0A
+import javax.swing.Action;%0A
 import j
@@ -642,16 +642,26 @@
 ltip) %7B%0A
+%09%09this();%0A
 %09%09setTex
@@ -696,16 +696,116 @@
 oltip);%0A
+%09%7D%0A%0A%09public SimpleLink(Action action) %7B%0A%09%09this();%0A%09%09setAction(action);%0A%09%7D%0A%0A%09protected SimpleLink() %7B
 %0A%09%09// st

add constructor from Action