当前位置: 首页>>代码示例>>Java>>正文


Java HyperlinkEvent.getURL方法代码示例

本文整理汇总了Java中javax.swing.event.HyperlinkEvent.getURL方法的典型用法代码示例。如果您正苦于以下问题:Java HyperlinkEvent.getURL方法的具体用法?Java HyperlinkEvent.getURL怎么用?Java HyperlinkEvent.getURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.event.HyperlinkEvent的用法示例。


在下文中一共展示了HyperlinkEvent.getURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHyperlinkListener

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public static HyperlinkListener createHyperlinkListener() {
    return new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent hlevt) {
            if (HyperlinkEvent.EventType.ACTIVATED == hlevt.getEventType()) {
                final URL url = hlevt.getURL();
                if (url != null) {
                    try {
                        openBrowser(url.toURI());
                    } catch (URISyntaxException e) {
                        LogManager.log(e);
                    }
                }
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:BrowserUtils.java

示例2: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
    url = hyperlinkEvent.getURL();
    HyperlinkEvent.EventType type = hyperlinkEvent.getEventType();
    if (type == HyperlinkEvent.EventType.ENTERED) {
      isInsideHyperlink = true;
      pane.setToolTipText(getURLExternalForm()); // #176141
    }
    else if (type == HyperlinkEvent.EventType.ACTIVATED) {
      isInsideHyperlink = false;
      pane.setToolTipText(null);
    }
    else if (type == HyperlinkEvent.EventType.EXITED) {
      isInsideHyperlink = false;
      pane.setToolTipText(null);
    }
    else {
      Installer.log.log(Level.SEVERE, "Unknown hyperlinkEvent: " +
                                       hyperlinkEvent);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:HyperlinkEventProcessor.java

示例3: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate (HyperlinkEvent event)
{
    HyperlinkEvent.EventType type = event.getEventType();
    final URL url = event.getURL();

    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            //System.out.println("Activated URL " + url);
            URI uri = new URI(url.toString());
            WebBrowser.getBrowser().launch(uri);
        } catch (URISyntaxException ex) {
            logger.warn("Illegal URI " + url, ex);
        }
    }
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:17,代码来源:GuiActions.java

示例4: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
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 {
        URL nurl = e.getURL();
        if (nurl == null) nurl = new URL(m_baseurl, e.getDescription());
        if (jsmooth.Native.isAvailable()) {
          jsmooth.Native.shellExecute(jsmooth.Native.SHELLEXECUTE_OPEN, nurl.toString(), null, null, jsmooth.Native.SW_NORMAL);
        } else
          m_launcher.openURLinBrowser(nurl.toExternalForm());
      } catch (Throwable t) {
        t.printStackTrace();
      }
    }
  }
}
 
开发者ID:BisonSchweizAG,项目名称:JSmooth,代码行数:23,代码来源:HTMLPane.java

示例5: createLinkEnabledEditorPane

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public static JEditorPane createLinkEnabledEditorPane(final Component parent,
                                                      String text) {
    JEditorPane pane = createEditorPane(text);
    HyperlinkListener linkListener = new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                URL url = e.getURL();
                if (!openBrowser(e.getURL())) {
                    JOptionPane.showMessageDialog(parent,
                                                  "An error occurred while opening the URL: " + url.toString(),
                                                  "Error", JOptionPane.ERROR_MESSAGE);
                }
            }
        }
    };
    pane.addHyperlinkListener(linkListener);
    return pane;
}
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:19,代码来源:UiUtil.java

示例6: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent event) {
    if(HyperlinkEvent.EventType.ENTERED == event.getEventType()) {
        url = event.getURL();
    } else if (HyperlinkEvent.EventType.EXITED == event.getEventType()) {
        url = null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ProductInformationPanel.java

示例7: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e) {
  if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
    if (e.getURL() != null) {
      update(e.getURL());
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:8,代码来源:HelpWindow.java

示例8: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent event) {
  if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
    return;
  }

  final String desc = event.getDescription();
  if ((!isURL() && desc.indexOf('/') < 0) || event.getURL() == null) {
    final int hash = desc.lastIndexOf("#");
    if (hash < 0) {
      // no anchor
      setFile(desc);
    }
    else if (hash > 0) {
      // browse to the part before the anchor
      setFile(desc.substring(0, hash));
    }

    if (hash != -1) {
      // we have an anchor
      htmlWin.scrollToReference(desc.substring(hash+1));
    }
  }
  else {
    try {
      htmlWin.setPage(event.getURL());
    }
    catch (IOException ex) {
      ReadErrorDialog.error(ex, event.getURL().toString());
    }
    htmlWin.revalidate();
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:33,代码来源:HtmlChart.java

示例9: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e)
{
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
    {
        URL url = e.getURL();
        String protocol = url.getProtocol();
        if (protocol.equals("jar") || protocol.equals("file"))
        {
            loadURL(url);
            appendHistory(url);
        }
        else
            openExternal(url);
    }
}
 
开发者ID:havkarl,项目名称:gogui2,代码行数:16,代码来源:Help.java

示例10: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(final HyperlinkEvent event) {
  URI uri = null;
  try {
    final URL url = event.getURL();
    uri = url.toURI(); //NOPMD
  } catch (final URISyntaxException exception) {
    LOGGER.logError("An logError occurred while retrieving URI: %s", exception);
  }
  if (isClicked(event)) {
    browseTo(uri);
  }
}
 
开发者ID:zaplatynski,项目名称:second-hand-log,代码行数:14,代码来源:HyperlinkExecutor.java

示例11: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        if (e.getURL() == null) {
            try (InputStream is = FileUtils.getResourceInputStream("/licenses/" + e.getDescription())) {
                new TextDialog("License - " + e.getDescription().substring(0, e.getDescription().indexOf('.')), FileUtils.convertStreamToString(is), true).showDialog();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } else {
            JHVGlobals.openURL(e.getURL().toString());
        }
    }
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:15,代码来源:AboutDialog.java

示例12: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        if (e.getURL() == null) {
            Plugin p = plugin.getPlugin();
            String text = "<center><p><big><b>" + p.getName() + "</b></big></p><p><b>Plug-in description</b><br/>" + p.getDescription() +
                          "</p><p><b>Plug-in license information</b><br/>" + p.getAboutLicenseText();
            new TextDialog("About", text, false).showDialog();
        } else {
            JHVGlobals.openURL(e.getURL().toString());
        }
    }
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:14,代码来源:PluginsListEntry.java

示例13: hyperlinkActivated

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
  URL url = event.getURL();
  if (url == null) {
    BrowserUtil.browse(event.getDescription());
  }
  else {
    BrowserUtil.browse(url);
  }
  if (myExpireNotification) {
    notification.expire();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:NotificationListener.java

示例14: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public @Override void hyperlinkUpdate(HyperlinkEvent evt) {
    if (EventType.ACTIVATED == evt.getEventType() && evt.getURL() != null) {
        HtmlBrowser.URLDisplayer.getDefault().showURL(evt.getURL());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:TemplatesPanelGUI.java

示例15: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent evt) {
    if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        new LoaderThread(evt.getURL());
    }
}
 
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:6,代码来源:SimpleWebBrowserWithThread.java


注:本文中的javax.swing.event.HyperlinkEvent.getURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。