R
rolf gabler
Hi,
I got an application which sould show a html-file
as frameset, with a navigation frame in a tabbedPanel
I built a class extended by JPanel with a JEditorPane
and so far.
the result is that a link like:
<a href="x.html" target="mainframe">
will not be interpreted correct,
the frameset disapear and only the
link-site is shown.
I believe this could be a problem with my HyperlinkListener, because
when I use the HTMLFrameHyperlinkEvent and the framset
is shown in a JFrame as popup correct and all links are
working (I put the code below this post)
I add the HyperlinkListener in the following way,
which isn't able to handle a frameset
public class HTMKpnl{
....
try{
....
myJEditPnl.setEditable(false);
myJEditPnl.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if(e.getEventType()==HyperlinkEvent.EventType.ACTIVATED)
try {
myJEditPnl.setPage(e.getURL());
}
catch(Exception x) {
System.out.println("Hyperlink listener
error is " + x.getMessage());
}
}}
);
JScrollPane scroller = new JScrollPane();
JViewport vp = scroller.getViewport();
vp.add(myJEditPnl);
add(scroller, BorderLayout.CENTER);
}
catch (MalformedURLException e) {}
catch (IOException e) {}
what is going wrong?
best regards
Rolf
#####this code works as it has to do####
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 {
myJEditPnl.setPage(e.getURL());
} catch (IOException ioe) {
System.out.println("InpuOutputError " + ioe);
}
}
}
}
);
I got an application which sould show a html-file
as frameset, with a navigation frame in a tabbedPanel
I built a class extended by JPanel with a JEditorPane
and so far.
the result is that a link like:
<a href="x.html" target="mainframe">
will not be interpreted correct,
the frameset disapear and only the
link-site is shown.
I believe this could be a problem with my HyperlinkListener, because
when I use the HTMLFrameHyperlinkEvent and the framset
is shown in a JFrame as popup correct and all links are
working (I put the code below this post)
I add the HyperlinkListener in the following way,
which isn't able to handle a frameset
public class HTMKpnl{
....
try{
....
myJEditPnl.setEditable(false);
myJEditPnl.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if(e.getEventType()==HyperlinkEvent.EventType.ACTIVATED)
try {
myJEditPnl.setPage(e.getURL());
}
catch(Exception x) {
System.out.println("Hyperlink listener
error is " + x.getMessage());
}
}}
);
JScrollPane scroller = new JScrollPane();
JViewport vp = scroller.getViewport();
vp.add(myJEditPnl);
add(scroller, BorderLayout.CENTER);
}
catch (MalformedURLException e) {}
catch (IOException e) {}
what is going wrong?
best regards
Rolf
#####this code works as it has to do####
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 {
myJEditPnl.setPage(e.getURL());
} catch (IOException ioe) {
System.out.println("InpuOutputError " + ioe);
}
}
}
}
);