Example usage for javax.swing.event HyperlinkEvent getEventType

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

Introduction

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

Prototype

public EventType getEventType() 

Source Link

Document

Gets the type of event.

Usage

From source file:net.java.sip.communicator.impl.gui.main.chat.ChatConversationPanel.java

/**
 * Opens a link in the default browser when clicked and shows link url in a
 * popup on mouseover.//  w  w w. j a v a 2  s .c om
 *
 * @param e The HyperlinkEvent.
 */
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
        String href = e.getDescription();

        this.isCurrentHrefImg = e.getSourceElement().getName().equals("img");
        this.currentHref = href;
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
        this.currentHref = "";
        this.isCurrentHrefImg = false;
    }
}

From source file:com.marginallyclever.makelangelo.MainGUI.java

/**
* 
* @param html String of valid HTML.//from w w  w  . j  a  v a  2  s  .  c  o m
* @return a 
*/
private JTextComponent createHyperlinkListenableJEditorPane(String html) {
    final JEditorPane bottomText = new JEditorPane();
    bottomText.setContentType("text/html");
    bottomText.setEditable(false);
    bottomText.setText(html);
    bottomText.setOpaque(false);
    final HyperlinkListener hyperlinkListener = new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
            if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (Desktop.isDesktopSupported()) {
                    try {
                        Desktop.getDesktop().browse(hyperlinkEvent.getURL().toURI());
                    } catch (IOException | URISyntaxException exception) {
                        // FIXME Auto-generated catch block
                        exception.printStackTrace();
                    }
                }

            }
        }
    };
    bottomText.addHyperlinkListener(hyperlinkListener);
    return bottomText;
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane1HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane1HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());//ww  w .j  a  va  2  s. c  o  m
    }
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane2HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane2HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());/*from w  ww  .  j av  a  2 s.  co m*/
    }
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane3HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane3HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());//from w ww.  j a va2 s . co m
    }
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane4HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane4HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());//from w  w  w. j  a  v  a  2  s. c  o  m
    }
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane5HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane5HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());//  w  w w . j ava  2  s  . c o m
    }
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane6HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane6HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());//from   www. ja  va2 s. c  o m
    }
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane7HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane7HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());/*w  ww  .j  a  v a 2s.c om*/
    }
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane8HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane8HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());/*from   w  ww.jav  a2  s.  c om*/
    }
}