![]() |
![]() |
|
|
|||||||
| Programmierung Rat & Tat für Programmierer |
![]() |
|
|
Themen-Optionen | Ansicht |
|
|
#1 |
|
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
Gibt es eine Möglichkleit in einem Java Programm eine html-Seite so anzuzeigen, daß Links funktionieren?
Jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona) Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing. \"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra) |
|
|
|
|
|
#2 |
|
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
Hat sich erledigt.
Man muß folgendes machen: Code:
JEditorPane helpEditorPane=new JEditorPane();
helpEditorPane.setPage(url);
helpEditorPane.setEditable(false);
helpEditorPane.addHyperlinkListener(new Hyperactive());
code für Hyperactive:
class Hyperactive implements HyperlinkListener {
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();
}
}
}
}
}
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona) Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing. \"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra) |
|
|
|
![]() |
| Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|