Example usage for javax.swing.event HyperlinkEvent toString

List of usage examples for javax.swing.event HyperlinkEvent toString

Introduction

In this page you can find the example usage for javax.swing.event HyperlinkEvent toString.

Prototype

public String toString() 

Source Link

Document

Returns a String representation of this EventObject.

Usage

From source file:jamel.gui.JamelWindow.java

/**
 * Returns the info panel./*w ww  . j a v  a  2 s  .  c o m*/
 * @return the info panel.
 */
private Component getInfoPanel() {
    final JEditorPane editorPane = new JEditorPane("text/html", "<center>" + this.infoString + "</center>");
    editorPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
                try {
                    java.awt.Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (Exception ex) {
                    ex.printStackTrace();
                    JOptionPane.showMessageDialog(null,
                            "<html>" + "Error.<br>" + "Cause: " + e.toString() + ".<br>"
                                    + "Please see server.log for more details.</html>",
                            "Warning", JOptionPane.WARNING_MESSAGE);
                }
        }
    });
    editorPane.setEditable(false);
    final JScrollPane scrollPane = new JScrollPane(editorPane);
    return scrollPane;
}