01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin.common;
05:
06: import org.dijon.EditorPane;
07:
08: import javax.swing.event.HyperlinkEvent;
09: import javax.swing.event.HyperlinkListener;
10: import javax.swing.text.html.HTMLDocument;
11: import javax.swing.text.html.HTMLFrameHyperlinkEvent;
12:
13: public class XEditorPane extends EditorPane {
14: public XEditorPane() {
15: super ();
16: addHyperlinkListener(new Hyperactive());
17: }
18:
19: class Hyperactive implements HyperlinkListener {
20: public void hyperlinkUpdate(HyperlinkEvent e) {
21: System.out.println(e);
22:
23: if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
24: XEditorPane pane = (XEditorPane) e.getSource();
25:
26: if (e instanceof HTMLFrameHyperlinkEvent) {
27: HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
28: HTMLDocument doc = (HTMLDocument) pane
29: .getDocument();
30:
31: doc.processHTMLFrameHyperlinkEvent(evt);
32: } else {
33: try {
34: pane.setPage(e.getURL());
35: } catch (Throwable t) {
36: t.printStackTrace();
37: }
38: }
39: }
40: }
41: }
42: }
|