mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-11 03:45:06 -05:00
adb4d68055
* AbstractSearchPanel (used in SubtitlePanel only so far) * started using GlazedLists * replaced searchtextfield with customized combobox (will be used for completion in the future) * renamed FileFormat to FileUtil and move to tuned * removed ESC shortcut
59 lines
1.2 KiB
Java
59 lines
1.2 KiB
Java
|
|
package net.sourceforge.tuned.ui;
|
|
|
|
|
|
import java.awt.Color;
|
|
import java.awt.Cursor;
|
|
import java.awt.Desktop;
|
|
import java.awt.SystemColor;
|
|
import java.awt.event.MouseAdapter;
|
|
import java.awt.event.MouseEvent;
|
|
import java.awt.event.MouseListener;
|
|
import java.net.URI;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
import javax.swing.JLabel;
|
|
|
|
|
|
public class HyperlinkLabel extends JLabel {
|
|
|
|
private final URI link;
|
|
private final Color defaultColor;
|
|
|
|
|
|
public HyperlinkLabel(String label, URI link) {
|
|
super(label);
|
|
this.link = link;
|
|
defaultColor = getForeground();
|
|
addMouseListener(linker);
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
|
}
|
|
|
|
private MouseListener linker = new MouseAdapter() {
|
|
|
|
@Override
|
|
public void mouseClicked(MouseEvent event) {
|
|
try {
|
|
Desktop.getDesktop().browse(link);
|
|
} catch (Exception e) {
|
|
// should not happen
|
|
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, e.toString(), e);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
public void mouseEntered(MouseEvent e) {
|
|
setForeground(SystemColor.textHighlight);
|
|
}
|
|
|
|
|
|
@Override
|
|
public void mouseExited(MouseEvent e) {
|
|
setForeground(defaultColor);
|
|
}
|
|
};
|
|
|
|
}
|