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