コード例 #1
0
 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);
   }
 }
コード例 #2
0
ファイル: HelpWindow.java プロジェクト: Pitel/dZama
 /*
  * 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!");
     }
   }
 }
コード例 #3
0
 /** Notification of a change relative to a hyperlink. */
 public void hyperlinkUpdate(HyperlinkEvent e) {
   if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
     linkActivated(e.getURL());
   }
 }