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


Java HyperlinkEvent.getSource方法代码示例

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


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

示例1: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(final HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        final JEditorPane pane = (JEditorPane) e.getSource();
        if (e instanceof HTMLFrameHyperlinkEvent) {
            final HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
            final HTMLDocument doc = (HTMLDocument) pane.getDocument();
            doc.processHTMLFrameHyperlinkEvent(evt);
        } else {
            try {
                pane.setPage(e.getURL());
            } catch (final Throwable t) {
                MessageBox.showError(HtmlViewer.this.getParent(), t.getMessage());
            }
        }
    }
}
 
开发者ID:chadbeaudin,项目名称:DataRecorder,代码行数:18,代码来源:HtmlViewer.java

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

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

示例4: disableLink

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
private static void disableLink(@NotNull final HyperlinkEvent event, @Nullable final String linkText) {
  if (event.getSource() instanceof MyJEditorPane) {
    UIUtil.invokeLaterIfNeeded(new Runnable() {
      @Override
      public void run() {
        final MyJEditorPane editorPane = (MyJEditorPane)event.getSource();
        editorPane.myElement.addDisabledLink(event.getDescription(), linkText);
        editorPane.myElement.updateStyle(editorPane, null, null, true, false);
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:EditableNotificationMessageElement.java

示例5: openFatals

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
private static void openFatals(HyperlinkEvent event, LogMessage message) {
  Object source = event.getSource();
  if (source instanceof Component) {
    Window window = SwingUtilities.getWindowAncestor((Component)source);
    if (window instanceof IdeFrame) {
      final StatusBar statusBar = ((IdeFrame)window).getStatusBar();
      StatusBarWidget widget = statusBar == null ? null : statusBar.getWidget(IdeMessagePanel.FATAL_ERROR);
      if (widget instanceof IdeMessagePanel) {
        ((IdeMessagePanel)widget).openFatals(message);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ErrorNotifier.java

示例6: RenderErrorPanel

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public RenderErrorPanel() {
  super(new BorderLayout());
  setOpaque(false);
  myHTMLViewer = new JEditorPane(UIUtil.HTML_MIME, "<HTML><BODY>Render Problems</BODY></HTML>");
  myHTMLViewer.setEditable(false);
  myHyperLinkListener = new HyperlinkListener() {
    @Override
    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);
          return;
        }

        String url = e.getDescription();
        if (url.equals(URL_ACTION_CLOSE)) {
          close();
          return;
        }
        performClick(url);
      }
    }
  };
  myHTMLViewer.addHyperlinkListener(myHyperLinkListener);
  myHTMLViewer.setMargin(new Insets(3, 3, 3, 3));

  myScrollPane = ScrollPaneFactory.createScrollPane(myHTMLViewer);
  setupStyle();

  add(myScrollPane, BorderLayout.CENTER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:RenderErrorPanel.java


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