44 |
import java.net.URL; |
import java.net.URL; |
45 |
|
|
46 |
import javax.accessibility.AccessibleContext; |
import javax.accessibility.AccessibleContext; |
47 |
|
import javax.accessibility.AccessibleStateSet; |
48 |
import javax.swing.event.HyperlinkEvent; |
import javax.swing.event.HyperlinkEvent; |
49 |
import javax.swing.event.HyperlinkListener; |
import javax.swing.event.HyperlinkListener; |
50 |
import javax.swing.text.BadLocationException; |
import javax.swing.text.BadLocationException; |
51 |
import javax.swing.text.DefaultEditorKit; |
import javax.swing.text.DefaultEditorKit; |
52 |
|
import javax.swing.text.Document; |
53 |
import javax.swing.text.EditorKit; |
import javax.swing.text.EditorKit; |
54 |
import javax.swing.text.JTextComponent; |
import javax.swing.text.JTextComponent; |
55 |
|
|
78 |
*/ |
*/ |
79 |
public class JEditorPane extends JTextComponent |
public class JEditorPane extends JTextComponent |
80 |
{ |
{ |
81 |
|
/** |
82 |
|
* Provides accessibility support for <code>JEditorPane</code>. |
83 |
|
* |
84 |
|
* @author Roman Kennke (kennke@aicas.com) |
85 |
|
*/ |
86 |
|
protected class AccessibleJEditorPane extends AccessibleJTextComponent |
87 |
|
{ |
88 |
|
|
89 |
|
/** |
90 |
|
* Creates a new <code>AccessibleJEditorPane</code> object. |
91 |
|
*/ |
92 |
|
protected AccessibleJEditorPane() |
93 |
|
{ |
94 |
|
super(); |
95 |
|
} |
96 |
|
|
97 |
|
/** |
98 |
|
* Returns a description of this <code>AccessibleJEditorPane</code>. If |
99 |
|
* this property is not set, then this returns the content-type of the |
100 |
|
* editor pane. |
101 |
|
* |
102 |
|
* @return a description of this AccessibleJEditorPane |
103 |
|
*/ |
104 |
|
public String getAccessibleDescription() |
105 |
|
{ |
106 |
|
String descr = super.getAccessibleDescription(); |
107 |
|
if (descr == null) |
108 |
|
return getContentType(); |
109 |
|
else |
110 |
|
return descr; |
111 |
|
} |
112 |
|
|
113 |
|
/** |
114 |
|
* Returns the accessible state of this <code>AccessibleJEditorPane</code>. |
115 |
|
* |
116 |
|
* @return the accessible state of this <code>AccessibleJEditorPane</code> |
117 |
|
*/ |
118 |
|
public AccessibleStateSet getAccessibleStateSet() |
119 |
|
{ |
120 |
|
AccessibleStateSet state = super.getAccessibleStateSet(); |
121 |
|
// TODO: Figure out what state must be added here to the super's state. |
122 |
|
return state; |
123 |
|
} |
124 |
|
} |
125 |
|
|
126 |
private static final long serialVersionUID = 3140472492599046285L; |
private static final long serialVersionUID = 3140472492599046285L; |
127 |
|
|
128 |
private URL page; |
private URL page; |
175 |
listeners[index].hyperlinkUpdate(event); |
listeners[index].hyperlinkUpdate(event); |
176 |
} |
} |
177 |
|
|
178 |
|
/** |
179 |
|
* Returns the accessible context associated with this editor pane. |
180 |
|
* |
181 |
|
* @return the accessible context associated with this editor pane |
182 |
|
*/ |
183 |
public AccessibleContext getAccessibleContext() |
public AccessibleContext getAccessibleContext() |
184 |
{ |
{ |
185 |
return null; |
if (accessibleContext == null) |
186 |
|
// FIXME: Implement and use AccessibleJEditorPaneHTML when the editorKit |
187 |
|
// is an instance of HTMLEditorKit. |
188 |
|
accessibleContext = new AccessibleJEditorPane(); |
189 |
|
return accessibleContext; |
190 |
} |
} |
191 |
|
|
192 |
public final String getContentType() |
public final String getContentType() |