本文整理汇总了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);
}
}
}
}
};
}
示例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);
}
}
示例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;
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
};
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
}
};
}
示例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);
}
}
示例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
}
}
示例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;
}
}
示例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());
}
}
示例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);
}
示例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);
}