public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) { HyperlinkEvent.EventType type = hyperlinkEvent.getEventType(); final URL url = hyperlinkEvent.getURL(); // if (type == HyperlinkEvent.EventType.ENTERED) { // Utility.debugPrintln("patterns","Entered " + url.toString()); // } else if (type == HyperlinkEvent.EventType.EXITED) { // Utility.debugPrintln("patterns","Exited"); // } if (type == HyperlinkEvent.EventType.ACTIVATED) { // Utility.debugPrintln("Activated"); Runnable runner = new Runnable() { public void run() { // Retain reference to original Document doc = editorPane.getDocument(); try { editorPane.setPage(url); } catch (IOException ioException) { JOptionPane.showMessageDialog( frame, "Error following link " + url.toString(), "GIPO Error", JOptionPane.ERROR_MESSAGE); editorPane.setDocument(doc); } } }; SwingUtilities.invokeLater(runner); } }
/* * Obsluha kliknuti na odkaz * * @param event Udalost odkazu */ public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { htmlPane.setPage(event.getURL()); } catch (IOException ioe) { System.err.println("Page doesn't exist!"); } } }
/** Notification of a change relative to a hyperlink. */ public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { linkActivated(e.getURL()); } }