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


Java HyperlinkEvent.getEventType方法代码示例

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


在下文中一共展示了HyperlinkEvent.getEventType方法的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 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

示例4: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(final HyperlinkEvent event) {
    if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            Desktop.getDesktop().browse(event.getURL().toURI());
        } catch (final IOException | URISyntaxException e) {
            throw new RuntimeException("Can't open URL", e);
        }
    }
}
 
开发者ID:phweda,项目名称:MFM,代码行数:11,代码来源:MFMHTMLTextPane.java

示例5: wrapListener

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Nullable
public static HyperlinkListener wrapListener(@NotNull final Notification notification) {
  final NotificationListener listener = notification.getListener();
  if (listener == null) return null;

  return new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        final NotificationListener listener1 = notification.getListener();
        if (listener1 != null) {
          listener1.hyperlinkUpdate(notification, e);
        }
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NotificationsUtil.java

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

示例7: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
  if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    final String description = event.getDescription();
    if ("enable".equals(description)) {
      KeyboardSettingsExternalizable.getInstance().setNonEnglishKeyboardSupportEnabled(true);
    }
    else if ("settings".equals(description)) {
      final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
      IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
      //util.editConfigurable((JFrame)ideFrame, new StatisticsConfigurable(true));
      util.showSettingsDialog(ideFrame.getProject(), KeymapPanel.class);
    }

    NotificationsConfiguration.getNotificationsConfiguration().changeSettings(LOCALIZATION_GROUP_DISPLAY_ID, NotificationDisplayType.NONE, false, false);
    notification.expire();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:KeyboardInternationalizationNotificationManager.java

示例8: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(HyperlinkEvent he) {
    if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            jEditorPane1.setPage(he.getURL());
        } catch (IOException ex) {
            logger.log(Level.INFO, "Loading page failed", ex);
            try {
                logger.log(Level.WARNING, "Could not open web page!");
                URL startUrl = new URL(org.openide.util.NbBundle.getMessage(WelcomeScreenTopComponent.class, "WelcomeScreenTopComponent.local.link"));
                jEditorPane1.setPage(startUrl);
            } catch (IOException ex1) {
                logger.log(Level.SEVERE, "Could not open local help page!", ex1);
            }
        }
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:18,代码来源:WelcomeScreenTopComponent.java

示例9: createHyperLinkListener

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
private HyperlinkListener createHyperLinkListener() {
    return new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (e instanceof HTMLFrameHyperlinkEvent) {
                    ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent(
                            (HTMLFrameHyperlinkEvent) e);
                } else {
                    try {
                        html.setPage(e.getURL());
                    } catch (IOException ioe) {
                        System.out.println("IOE: " + ioe);
                    }
                }
            }
        }
    };
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:19,代码来源:EditorPaneDemo.java

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

示例11: hyperlinkUpdate

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e)
{
	if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
		try {
			openUrl(e.getURL());
		} catch(UnsupportedOperationException ex) {
			Logger.log.error("Unable to open URL", ex);
			JOptionPane.showMessageDialog(
					mainPanel,
					"No browser launcher specified",
					"Unable to open link",
					JOptionPane.ERROR_MESSAGE
			);
		}
	}
	else
	{
		//TODO: show URL in status bar when mousing over
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:21,代码来源:SwingEngine.java

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

示例13: hyperlinkUpdate

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

    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        showURL(e.getURL());
    } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
        setCursor(Cursor.getDefaultCursor());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HTMLLabel.java

示例14: makeHyperLinkListener

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
private void makeHyperLinkListener(final Action action) {
	actionLinkListener = new HyperlinkListener() {

		@Override
		public void hyperlinkUpdate(HyperlinkEvent e) {
			if (e.getEventType() == EventType.ACTIVATED) {
				action.actionPerformed(
						new ActionEvent(LinkButton.this, ActionEvent.ACTION_PERFORMED, e.getDescription()));
			}
		}
	};
	addHyperlinkListener(actionLinkListener);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:LinkButton.java

示例15: makeHyperLinkListener

import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
/**
 * Creates the hyperlink listener for the given action.
 *
 * @param action
 */
private void makeHyperLinkListener(final Action action) {

	actionLinkListener = new HyperlinkListener() {

		@Override
		public void hyperlinkUpdate(HyperlinkEvent e) {
			if (e.getEventType() == EventType.ACTIVATED) {
				action.actionPerformed(new ActionEvent(AbstractLinkButton.this, ActionEvent.ACTION_PERFORMED, e
						.getDescription()));
			}
		}
	};
	addHyperlinkListener(actionLinkListener);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:AbstractLinkButton.java


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