javax.swing.text.html.HTMLFrameHyperlinkEvent Java Examples

The following examples show how to use javax.swing.text.html.HTMLFrameHyperlinkEvent. 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 File: LiMeUserAgreementFrame.java    From LiMe with 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 File: EditorPaneDemo.java    From littleluck with 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 File: EditorPaneDemo.java    From beautyeye with 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 File: HtmlDemo.java    From beautyeye with 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 File: EditorPaneDemo.java    From Darcula with 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 File: HtmlDemo.java    From Darcula with 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 File: PluginManagerMain.java    From consulo with 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 File: ManualHandler.java    From uima-uimaj with 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 File: HtmlViewerPanel.java    From bigtable-sql with 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);
					}
				}
			}
		}
	};
}