![]() |
![]() |
|
|
|||||||
| Programmierung Rat & Tat für Programmierer |
|
|
Themen-Optionen | Ansicht |
|
|
#3 |
|
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
Wie gesagt, wenn dir einfaches HTML reicht geht's mit Swing:
Code:
JEditorPane editorPane=newJEditorPane();
editorPane.setPage(this.class.getResource("index.htm"));
editorPane.setEditable(false);
editorPane.addHyperlinkListener(new editorPane_hyperlinkListener());
editorPane.setPreferredSize(new Dimension(800,400));
Code:
class editorPane_hyperlinkListener
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) | |
|
|