Java 类javax.swing.text.html.HTMLFrameHyperlinkEvent 实例源码
项目:DataRecorder
文件:HtmlViewer.java
@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());
}
}
}
}
项目:eva2
文件:HtmlDemo.java
/**
*
*/
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);
}
}
}
};
}
项目:JSmooth
文件:HTMLPane.java
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();
}
}
}
}
项目:littleluck
文件:EditorPaneDemo.java
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);
}
}
}
}
};
}
项目:intellij-ce-playground
文件:PluginManagerMain.java
@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);
}
}
}
}
项目:beautyeye
文件:EditorPaneDemo.java
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);
}
}
}
}
};
}
项目:beautyeye
文件:HtmlDemo.java
/**
* 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);
}
}
}
}
};
}
项目:eva2
文件:HtmlDemo.java
/**
*
*/
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);
}
}
}
};
}
项目:tellervo
文件:HelpBrowser.java
@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();
}
}
}
}
项目:javashare
文件:HttpLinkViewer.java
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();
}
}
}
}
项目:voxeldesc
文件:VoxelGUI.java
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());
}
}
}
项目:tools-idea
文件:PluginManagerMain.java
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);
}
}
}
}
项目:Darcula
文件:EditorPaneDemo.java
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);
}
}
}
}
};
}
项目:Darcula
文件:HtmlDemo.java
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);
}
}
}
}
};
}
项目:graph_editor
文件:AboutAction.java
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();
}
}
}
}
项目:consulo
文件:PluginManagerMain.java
@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);
}
}
}
}
项目:Second-Foundation-Src
文件:AntiAliasedEditorPane.java
/**
* 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();
}
}
}
}
项目:msInspect
文件:HtmlViewerPanel.java
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();
}
}
}
}
项目:msInspect
文件:UserManualCLM.java
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();
}
}
}
}
项目:JavaExamples
文件:Browser.java
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);
}
}
}
项目:intellij-ce-playground
文件:RenderErrorPanel.java
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);
}
项目:bigtable-sql
文件:HtmlViewerPanel.java
private HyperlinkListener createHyperLinkListener()
{
return new HyperlinkListener()
{
public void hyperlinkUpdate(HyperlinkEvent e)
{
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
if (e instanceof HTMLFrameHyperlinkEvent)
{
((HTMLDocument)_contentsTxt.getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)e);
}
else
{
try
{
gotoURL(e.getURL());
}
catch (IOException ex)
{
// i18n[HtmlViewerPanel.error.processhyperlink=Error processing hyperlink]
s_log.error(s_stringMgr.getString("HtmlViewerPanel.error.processhyperlink"), ex);
}
}
}
}
};
}
项目:mindraider
文件:TextWysiwygHyperlinkListener.java
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e instanceof HTMLFrameHyperlinkEvent) {
logger.debug("It is frame hyperlink event...");
final HTMLFrameHyperlinkEvent hyperEvent = (HTMLFrameHyperlinkEvent) e;
((HTMLDocument)wysiwyg.getDocument()).processHTMLFrameHyperlinkEvent(hyperEvent);
} else {
TextAnnotationPreviewHyperlinkListener.handleMindRaiderHyperlink(e);
}
}
}
项目:mindraider
文件:TextAnnotationPreviewHyperlinkListener.java
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e instanceof HTMLFrameHyperlinkEvent) {
logger.debug("It is frame hyperlink event...");
final HTMLFrameHyperlinkEvent hyperEvent = (HTMLFrameHyperlinkEvent) e;
((HTMLDocument) previewPane.getDocument())
.processHTMLFrameHyperlinkEvent(hyperEvent);
} else {
handleMindRaiderHyperlink(e);
}
}
}
项目:metasfresh
文件:OnlineHelp.java
/**************************************************************************
* Hyperlink Listener
*
* @param e event
*/
@Override
public void hyperlinkUpdate(HyperlinkEvent e)
{
// System.out.println("OnlineHelp.hyperlinkUpdate - " + e.getDescription() + " " + e.getURL());
if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED)
return;
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//
if (e instanceof HTMLFrameHyperlinkEvent)
{
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
HTMLDocument doc = (HTMLDocument)getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
}
else if (e.getURL() == null)
// remove # of the reference
scrollToReference(e.getDescription().substring(1));
else
{
try
{
setPage(e.getURL());
}
catch (Throwable t)
{
System.err.println("Help.hyperlinkUpdate - " + t.toString());
displayError("Error", e.getURL(), t);
}
}
this.setCursor(Cursor.getDefaultCursor());
}
项目:kmip4j
文件:KMIPClientGUIWebBrowserTab.java
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) jep.getDocument();
document.processHTMLFrameHyperlinkEvent(linkEvent);
} else {
showPage(event.getURL(), true);
}
}
}
项目:php-java-bridge
文件:TestInstallation.java
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 url = e.getURL();
if(url.getFile().endsWith("/"))
pane.setPage(e.getURL());
else {
JFrame frame = new JFrame(url.toExternalForm());
JEditorPane p = null;
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
p = new JEditorPane(url);
p.setEditable(false);
p.addHyperlinkListener(this);
JScrollPane scroll = new JScrollPane(p);
frame.getContentPane().add(scroll);
frame.setSize(800,600);
frame.setVisible(true);
}
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
项目:rapidminer-5
文件:Browser.java
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
HTMLDocument doc = (HTMLDocument) this.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
} else {
try {
setPage(e.getURL());
} catch (Throwable t) {
SwingTools.showSimpleErrorMessage("while_following_link", t);
}
}
}
}
项目:teamengine
文件:SwingForm.java
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 target = e.getURL();
if (target == null) {
target = new URL(new URL(core.opts.baseURI),
e.getDescription());
}
if (this == popupForm) {
pane.setPage(target);
} else {
if (popupForm == null) {
popupForm = new SwingForm(popupName);
popupForm.setSize(700, 500);
popupForm.setLocation(this.getX() + 30,
this.getY() + 30);
}
popupForm.jedit.setPage(target);
popupForm.setVisible(true);
}
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
项目:leader_election
文件:HelpDialog.java
private HyperlinkListener getLinkListener() {
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 {
currentURL = e.getURL();
String s = currentURL.toString();
int offset = s.indexOf(".html");
if(offset > 0) { // .html is in the string
s = s.substring(0, offset + 5);
s += "?help";
if(currentURL.getRef() != null) {
s += "#" + currentURL.getRef();
}
currentURL = new URL(s);
HelpDialog.this.setEnabled(true);
if(menuDlg != null) {
menuDlg.setVisible(false);
menuDlg = null;
}
}
html.setPage(currentURL);
} catch (IOException e1) {
html.setText("Cannot display the page.\n" + e1.getMessage());
}
}
}
}
};
}
项目:balloonist
文件:HypertextPane.java
public HypertextPane()
{
super();
setEditorKit(new ImmediateLoadingEditorKit());
addHyperlinkListener(new HyperlinkListener()
{
public void hyperlinkUpdate(HyperlinkEvent e)
{
String asString = urlToText(e.getURL());
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
if (asString.indexOf("#")==-1) // TODO no
{
PlatformFriend.openUrl(asString);
}
else
{
if (e instanceof HTMLFrameHyperlinkEvent)
{
HTMLFrameHyperlinkEvent asHTMLFrameHyperlinkEvent = (HTMLFrameHyperlinkEvent) e;
((HTMLDocument)getDocument()).processHTMLFrameHyperlinkEvent(asHTMLFrameHyperlinkEvent);
}
if (asString.length()>1)
{
String numberSignLess = asString.substring(1);
scrollToReference(numberSignLess);
}
}
}
else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED)
{
// System.out.println("hyperlink: entered");
setToolTipText(asString);
// for some reason, framed content doesn't seem to issue this event
}
else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED)
{
// System.out.println("hyperlink: entered");
setToolTipText(null); // TODO figure out how to make it actually dismiss the tooltip sooner, without messing up tooltips elsewhere. ToolTipManager?
// for some reason, framed content doesn't seem to issue this event
}
else
{
// System.out.println("unmapped hyperlink event type: "+e);
}
}
});
setEditable(false);
}
项目:SORCER
文件:HTMLView.java
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
URL newUrl = e.getURL();
// if this is a change from frames to no frames
// then zap the whole document - assume that when the orginal url is
// selected then reload
if (newUrl.equals(_startUrl)) {
_jep = new JEditorPane();
load(_startUrl);
return;
}
JEditorPane pane = (JEditorPane) e.getSource();
if (e instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
HTMLDocument doc = (HTMLDocument) pane.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
} else {
try {
if (_lastUrl == null || !newUrl.equals(_lastUrl)) {
// might need to move the line below out of this
// condition check
pane.setPage(newUrl);
_lastUrl = newUrl;
_cursor++;
if (_cursor < _history.size()) {
_history.add(_cursor, newUrl);
// System.out.println("Inserting page at "+_cursor+" "+newUrl);
// _fwd.setEnabled(true);
} else {
_history.add(newUrl);
// System.out.println("Added page at "+_cursor+" "+newUrl);
}
}
} catch (IOException ex) {
pane.setText("<html><body>Unable to load file " + newUrl
+ "</body></html>");
}
}
}
}
项目:vbrowser
文件:VHTMLViewer.java
public void hyperlinkUpdate(HyperlinkEvent e)
{
logger.debugPrintf("hyperlinkUpdate:%s\n",e);
try
{
boolean frameEvent=false;
VRL link=null;
VRL docVrl=null;
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
// get HTML Pane and stuff:
VHTMLEditorPane pane = (VHTMLEditorPane) e.getSource();
HTMLDocument doc = (HTMLDocument) pane.getDocument();
docVrl=new VRL(doc.getBase());
URL url=e.getURL();
if (url!=null)
{
logger.debugPrintf("hyperlinkUpdate: url=%s\n",url);
link=new VRL(url);
}
else
{
// resolve (relative) link
String uriStr=e.getDescription();
logger.debugPrintf("hyperlinkUpdate: uristr=%s\n",uriStr);
link=resolve(docVrl,uriStr);
}
if (e instanceof HTMLFrameHyperlinkEvent)
frameEvent=true;
if (super.handleLink(link,false)==false)
{
if (frameEvent==true)
{
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
doc.processHTMLFrameHyperlinkEvent(evt);
super.fireFrameLinkFollowedEvent(docVrl,link);
}
else
{
super.fireViewEvent(link,false);
}
}
}
}
catch(Exception ex)
{
this.handle(ex);
}
}
项目:vbrowser
文件:VHTMLViewer.java
public void hyperlinkUpdate(HyperlinkEvent e)
{
logger.debugPrintf("hyperlinkUpdate:%s\n",e);
try
{
boolean frameEvent=false;
VRL link=null;
VRL docVrl=null;
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
// get HTML Pane and stuff:
VHTMLEditorPane pane = (VHTMLEditorPane) e.getSource();
HTMLDocument doc = (HTMLDocument) pane.getDocument();
docVrl=new VRL(doc.getBase());
URL url=e.getURL();
if (url!=null)
{
logger.debugPrintf("hyperlinkUpdate: url=%s\n",url);
link=new VRL(url);
}
else
{
// resolve (relative) link
String uriStr=e.getDescription();
logger.debugPrintf("hyperlinkUpdate: uristr=%s\n",uriStr);
link=resolve(docVrl,uriStr);
}
if (e instanceof HTMLFrameHyperlinkEvent)
frameEvent=true;
if (super.handleLink(link,false)==false)
{
if (frameEvent==true)
{
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
doc.processHTMLFrameHyperlinkEvent(evt);
super.fireFrameLinkFollowedEvent(docVrl,link);
}
else
{
super.fireViewEvent(link,false);
}
}
}
}
catch(Exception ex)
{
this.handle(ex);
}
}