/** @see javax.swing.event.HyperlinkListener#hyperlinkUpdate(javax.swing.event.HyperlinkEvent) */ public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (event.getURL().toString().startsWith("http")) { return; } if (event.getURL().toString().endsWith("sdx")) { String file = event.getURL().toString(); file = file.substring(file.lastIndexOf('/') + 1); fireHyperlinkClicked("example:" + file); } else if (event.getURL().toString().indexOf('#') > 0) { try { JEditorPane pane = (JEditorPane) event.getSource(); pane.setPage(event.getURL()); } catch (Exception e) { /* empty */ } } else if (event.getURL().toString().endsWith("html")) { String file = event.getURL().toString(); file = file.substring(file.lastIndexOf('/') + 1); fireHyperlinkClicked("help:" + file); } } }
/** * Update the browser links * * @param event on hyperlink event */ @Override public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (event.getDescription().startsWith("http://") || event.getDescription().startsWith("https://") || event.getDescription().startsWith("ftp://")) { WebBrowser.openUrl(event.getURL(), event.getDescription()); } else if (event.getDescription().startsWith(SCILAB_PROTO)) { if (helpSets == null) { initHelpSets(x.getModel().getHelpSet()); } URL url = resolvScilabLink(event); if (url != null) { super.hyperlinkUpdate( new HyperlinkEvent(event.getSource(), event.getEventType(), url, "")); } } else if (event.getDescription().startsWith(FILE_PROTO)) { String url = event.getDescription(); url = url.replaceFirst("SCI", Matcher.quoteReplacement(SCI)); WebBrowser.openUrl(url); } else { super.hyperlinkUpdate(event); } } }
/** * @see javax.swing.event.HyperlinkListener#hyperlinkUpdate(javax.swing.event.HyperlinkEvent) */ public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == EventType.ACTIVATED) { if (e.getSource() == fPaneSelectTimeIntervalOne) { handleSelectTimeIntervalOne(); } } }
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 { String url = e.getURL().toString(); Loader loader = LoaderFactory.getInstance().newLoader(); loader.download(url, new Target(Library.PRIMARY_FRAME, null)); } } }
// implemented for HyperlinkListener public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane ep = (JEditorPane) (e.getSource()); // handle frame events properly if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) (ep.getDocument()); doc.processHTMLFrameHyperlinkEvent(evt); } else // handle normal links { try { URL currentLoc = new URL(location); URL newLoc = new URL(currentLoc, e.getDescription()); setBrowserLocation(newLoc.toString()); } catch (MalformedURLException malUrl) { JOptionPane.showMessageDialog( this, "Malformed URL", "Browser Error", JOptionPane.ERROR_MESSAGE); return; } } } }