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


Java HyperlinkEvent.EventType方法代码示例

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


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

示例1: 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

示例2: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    HyperlinkEvent.EventType type = e.getEventType();
    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        String[] path = e.getURL().getPath().split("/");
        if (null != path[1]) {
            switch (path[1]) {
            case FreeColObject.ID_ATTRIBUTE_TAG:
                select(path[2]);
                break;
            case "action":
                getFreeColClient().getActionManager()
                    .getFreeColAction(path[2]).actionPerformed(null);
                break;
            default:
                break;
            }
        }
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:21,代码来源:ColopediaPanel.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 event) {
    JEditorPane descriptionPane = (JEditorPane) event.getSource();
    HyperlinkEvent.EventType type = event.getEventType();
    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            DemoUtilities.browse(event.getURL().toURI());
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println(e);
        }

    } else if (type == HyperlinkEvent.EventType.ENTERED) {
        defaultCursor = descriptionPane.getCursor();
        descriptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    } else if (type == HyperlinkEvent.EventType.EXITED) {
        descriptionPane.setCursor(defaultCursor);
    }
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:20,代码来源:HTMLPanel.java

示例5: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent event) {
    HyperlinkEvent.EventType eventType = event.getEventType();
    if (eventType == HyperlinkEvent.EventType.ACTIVATED) {
        if (event instanceof HTMLFrameHyperlinkEvent) {
            HTMLFrameHyperlinkEvent linkEvent = (HTMLFrameHyperlinkEvent) event;
            HTMLDocument document = (HTMLDocument) displayEditorPane
                    .getDocument();
            document.processHTMLFrameHyperlinkEvent(linkEvent);
        } else {
            showPage(event.getURL(), true);
        }
    }
}
 
开发者ID:tekrei,项目名称:JavaExamples,代码行数:14,代码来源:Browser.java


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