Java Code Examples for javax.swing.text.html.HTMLFrameHyperlinkEvent

The following examples show how to use javax.swing.text.html.HTMLFrameHyperlinkEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: LiMe   Source File: LiMeUserAgreementFrame.java    License: MIT License 6 votes vote down vote up
private HyperlinkListener createHyperLinkListener() {
    return e -> {
        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            if (e instanceof HTMLFrameHyperlinkEvent) {
                ((HTMLDocument) htmlPane.getDocument()).processHTMLFrameHyperlinkEvent(
                        (HTMLFrameHyperlinkEvent) e);
            } else {
                try {
                    htmlPane.setPage(e.getURL());
                } catch (IOException ioe) {
                    System.out.println("IOE: " + ioe);
                }
            }
        }
    };
}
 
Example 2
Source Project: littleluck   Source File: EditorPaneDemo.java    License: Apache License 2.0 6 votes vote down vote up
private HyperlinkListener createHyperLinkListener() {
    return new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (e instanceof HTMLFrameHyperlinkEvent) {
                    ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent(
                            (HTMLFrameHyperlinkEvent) e);
                } else {
                    try {
                        html.setPage(e.getURL());
                    } catch (IOException ioe) {
                        System.out.println("IOE: " + ioe);
                    }
                }
            }
        }
    };
}
 
Example 3
Source Project: beautyeye   Source File: EditorPaneDemo.java    License: Apache License 2.0 6 votes vote down vote up
private HyperlinkListener createHyperLinkListener() {
    return new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (e instanceof HTMLFrameHyperlinkEvent) {
                    ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent(
                            (HTMLFrameHyperlinkEvent) e);
                } else {
                    try {
                        html.setPage(e.getURL());
                    } catch (IOException ioe) {
                        System.out.println("IOE: " + ioe);
                    }
                }
            }
        }
    };
}
 
Example 4
Source Project: beautyeye   Source File: HtmlDemo.java    License: Apache License 2.0 6 votes vote down vote up
/**
    * Creates the hyper link listener.
    *
    * @return the hyperlink listener
    */
   public HyperlinkListener createHyperLinkListener() {
return new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
	if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
	    if (e instanceof HTMLFrameHyperlinkEvent) {
		((HTMLDocument)html.getDocument()).processHTMLFrameHyperlinkEvent(
		    (HTMLFrameHyperlinkEvent)e);
	    } else {
		try {
		    html.setPage(e.getURL());
		} catch (IOException ioe) {
		    System.out.println("IOE: " + ioe);
		}
	    }
	}
    }
};
   }
 
Example 5
Source Project: Darcula   Source File: EditorPaneDemo.java    License: Apache License 2.0 6 votes vote down vote up
private HyperlinkListener createHyperLinkListener() {
    return new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (e instanceof HTMLFrameHyperlinkEvent) {
                    ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent(
                            (HTMLFrameHyperlinkEvent) e);
                } else {
                    try {
                        html.setPage(e.getURL());
                    } catch (IOException ioe) {
                        System.out.println("IOE: " + ioe);
                    }
                }
            }
        }
    };
}
 
Example 6
Source Project: Darcula   Source File: HtmlDemo.java    License: Apache License 2.0 6 votes vote down vote up
public HyperlinkListener createHyperLinkListener() {
return new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
	if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
	    if (e instanceof HTMLFrameHyperlinkEvent) {
		((HTMLDocument)html.getDocument()).processHTMLFrameHyperlinkEvent(
		    (HTMLFrameHyperlinkEvent)e);
	    } else {
		try {
		    html.setPage(e.getURL());
		} catch (IOException ioe) {
		    System.out.println("IOE: " + ioe);
		}
	    }
	}
    }
};
   }
 
Example 7
Source Project: consulo   Source File: PluginManagerMain.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    JEditorPane pane = (JEditorPane)e.getSource();
    if (e instanceof HTMLFrameHyperlinkEvent) {
      HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
      HTMLDocument doc = (HTMLDocument)pane.getDocument();
      doc.processHTMLFrameHyperlinkEvent(evt);
    }
    else {
      URL url = e.getURL();
      if (url != null) {
        BrowserUtil.browse(url);
      }
    }
  }
}
 
Example 8
Source Project: uima-uimaj   Source File: ManualHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    JEditorPane pane = (JEditorPane) e.getSource();
    if (e instanceof HTMLFrameHyperlinkEvent) {
      HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
      HTMLDocument doc = (HTMLDocument) pane.getDocument();
      doc.processHTMLFrameHyperlinkEvent(evt);
    } else {
      try {
        pane.setPage(e.getURL());
      } catch (Throwable t) {
        t.printStackTrace();
      }
    }
  }
}
 
Example 9
Source Project: bigtable-sql   Source File: HtmlViewerPanel.java    License: Apache License 2.0 5 votes vote down vote up
private HyperlinkListener createHyperLinkListener()
{
	return new HyperlinkListener()
	{
		public void hyperlinkUpdate(HyperlinkEvent e)
		{
			if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
			{
				if (e instanceof HTMLFrameHyperlinkEvent)
				{
					((HTMLDocument)_contentsTxt.getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)e);
				}
				else
				{
					try
					{
						gotoURL(e.getURL());
					}
					catch (IOException ex)
					{
                           // i18n[HtmlViewerPanel.error.processhyperlink=Error processing hyperlink]
						s_log.error(s_stringMgr.getString("HtmlViewerPanel.error.processhyperlink"), ex);
					}
				}
			}
		}
	};
}