本文整理汇总了Java中javax.swing.text.html.HTMLFrameHyperlinkEvent类的典型用法代码示例。如果您正苦于以下问题:Java HTMLFrameHyperlinkEvent类的具体用法?Java HTMLFrameHyperlinkEvent怎么用?Java HTMLFrameHyperlinkEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HTMLFrameHyperlinkEvent类属于javax.swing.text.html包,在下文中一共展示了HTMLFrameHyperlinkEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的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());
}
}
}
}
示例2: createHyperLinkListener
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
/**
*
*/
public HyperlinkListener createHyperLinkListener() {
return e -> {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e instanceof HTMLFrameHyperlinkEvent) {
((HTMLDocument) htmlEditorPane.getDocument()).processHTMLFrameHyperlinkEvent(
(HTMLFrameHyperlinkEvent) e);
} else {
try {
htmlEditorPane.setPage(e.getURL());
} catch (IOException ioe) {
System.out.println("IOE: " + ioe);
}
}
}
};
}
示例3: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的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();
}
}
}
}
示例4: createHyperLinkListener
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的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);
}
}
}
}
};
}
示例5: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
@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);
}
else {
URL url = e.getURL();
if (url != null) {
BrowserUtil.browse(url);
}
}
}
}
示例6: createHyperLinkListener
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
/**
* Creates the hyper link listener.
*
* @return the hyperlink listener
*/
public 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);
}
}
}
}
};
}
示例7: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
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 {
// history
back.push(pane.getPage());
fwd = new Stack();
// move
pane.setPage(e.getURL());
backButton.setEnabled(true);
fwdButton.setEnabled(false);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
示例8: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e instanceof HTMLFrameHyperlinkEvent) {
((HTMLDocument)htmlView.getDocument()).processHTMLFrameHyperlinkEvent(
(HTMLFrameHyperlinkEvent)e);
} else {
try {
htmlView.setPage(e.getURL());
this.setTitle("JavaShare Mini-Browser: " +
e.getURL().toString());
} catch (IOException ioe) {
JOptionPane.showMessageDialog(this,
"An Error has occured while trying to read this page.",
"Mini-Browser Error", JOptionPane.ERROR_MESSAGE);
this.dispose();
}
}
}
}
示例9: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED)
return;
JEditorPane pane = (JEditorPane) e.getSource();
if (e instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt =
(HTMLFrameHyperlinkEvent) e;
HTMLDocument doc = (HTMLDocument) help.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
} else {
try {
help.setPage(e.getURL());
} catch (IOException e2) {
help.setText("Error loading " + e.getURL());
}
}
}
示例10: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的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 {
URL url = e.getURL();
if (url != null) {
BrowserUtil.browse(url);
}
}
}
}
示例11: createHyperLinkListener
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
public 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);
}
}
}
}
};
}
示例12: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的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 {
pane.setPage(e.getURL());
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
示例13: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的package包/类
/**
* used to follow hyperlink events in the editor pane
* @param evt a Hyperlink Event
*/
public void hyperlinkUpdate(HyperlinkEvent evt) {
HyperlinkEvent.EventType type = evt.getEventType();
if (type == HyperlinkEvent.EventType.ENTERED) {
System.out.println(evt.getURL().toString());
} else if (type == HyperlinkEvent.EventType.EXITED) {
System.out.println("Exited");
} else if (type == HyperlinkEvent.EventType.ACTIVATED) {
if (evt instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt1 = (HTMLFrameHyperlinkEvent) evt;
HTMLDocument doc = (HTMLDocument) getDocument();
doc.processHTMLFrameHyperlinkEvent(evt1);
} else {
try {
setPage(evt.getURL());
System.out.println(evt.getURL().toString());
} catch (FileNotFoundException fnfe) {
setText("Could not open file: <tt>" + evt.getURL() + "</tt>.<hr>");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
示例14: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的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 {
pane.setPage(e.getURL());
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
示例15: hyperlinkUpdate
import javax.swing.text.html.HTMLFrameHyperlinkEvent; //导入依赖的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);
}
}
}