javax.swing
public class JEditorPane extends JTextComponent
text/plain
: Plain text, handled by
{@link javax.swing.text.DefaultEditorKit}.text/html
: HTML 4.0 styled text, handled by
{@link javax.swing.text.html.HTMLEditorKit}.text/rtf
: RTF text, handled by
{@link javax.swing.text.rtf.RTFEditorKit}.Nested Class Summary | |
---|---|
protected class | JEditorPane.AccessibleJEditorPane
Provides accessibility support for JEditorPane .
|
protected class | JEditorPane.AccessibleJEditorPaneHTML
Provides accessibility support for JEditorPane s, when the
editor kit is an instance of {@link HTMLEditorKit}.
|
protected class | JEditorPane.JEditorPaneAccessibleHypertextSupport
This is the accessible text that is returned by
{@link AccessibleJEditorPaneHTML#getAccessibleText()}.
|
Constructor Summary | |
---|---|
JEditorPane() | |
JEditorPane(String url) | |
JEditorPane(String type, String text) | |
JEditorPane(URL url) |
Method Summary | |
---|---|
void | addHyperlinkListener(HyperlinkListener listener)
Add a HyperlinkListener object to this editor pane.
|
protected EditorKit | createDefaultEditorKit() |
static EditorKit | createEditorKitForContentType(String type)
Creates and returns an EditorKit that is appropriate for the given
content type. |
void | fireHyperlinkUpdate(HyperlinkEvent event)
Sends a given HyperlinkEvent to all registered listeners.
|
AccessibleContext | getAccessibleContext()
Returns the accessible context associated with this editor pane.
|
String | getContentType() |
EditorKit | getEditorKit()
Returns the EditorKit. |
static String | getEditorKitClassNameForContentType(String type)
Returns the class name of the EditorKit associated with the given
content type.
|
EditorKit | getEditorKitForContentType(String type)
Returns the EditorKit to use for the given content type. |
HyperlinkListener[] | getHyperlinkListeners()
Returns all added HyperlinkListener objects.
|
URL | getPage() |
Dimension | getPreferredSize()
Returns the preferred size for the JEditorPane. |
boolean | getScrollableTracksViewportHeight()
Returns true when a Viewport should force the height of
this component to match the viewport height. |
boolean | getScrollableTracksViewportWidth()
Returns true when a Viewport should force the width of
this component to match the viewport width. |
protected InputStream | getStream(URL page) |
String | getText() |
String | getUIClassID() |
boolean | isFocusCycleRoot() |
protected String | paramString() |
void | read(InputStream in, Object desc)
This method initializes from a stream. |
static void | registerEditorKitForContentType(String type, String classname)
Establishes a binding between type and classname. |
static void | registerEditorKitForContentType(String type, String classname, ClassLoader loader)
Establishes the default bindings of type to classname. |
void | removeHyperlinkListener(HyperlinkListener listener)
Removes a HyperlinkListener object to this editor pane.
|
void | replaceSelection(String content)
Replaces the currently selected content with new content represented
by the given string. |
void | scrollToReference(String reference)
Scrolls the view to the given reference location (that is, the value
returned by the UL.getRef method for the URL being displayed). |
void | setContentType(String type) |
void | setEditorKit(EditorKit newValue) |
void | setEditorKitForContentType(String type, EditorKit k)
Explicitly sets an EditorKit to be used for the given content type. |
void | setPage(String url)
Sets the current URL being displayed. |
void | setPage(URL page)
Sets the current URL being displayed. |
void | setText(String t)
Sets the text of the JEditorPane. |
HyperlinkListener
object to this editor pane.
Parameters: listener the listener to add
Parameters: type the content type
Returns: an EditorKit for use with the given content type
See Also: JEditorPane JEditorPane
HyperlinkEvent
to all registered listeners.
Parameters: event the event to send
Returns: the accessible context associated with this editor pane
Parameters: type the content type
Returns: the class name of the EditorKit associated with this content type
Since: 1.3
setEditorKitForContentType
then it will be returned. Otherwise an attempt will be made to create
an EditorKit from the default recognzied content types or any
EditorKits that have been registered. If none can be created, a
PlainEditorKit is created.
Parameters: type the content type
Returns: an appropriate EditorKit for the given content type
See Also: JEditorPane JEditorPane
HyperlinkListener
objects.
Returns: array of listeners
Since: 1.4
true
,
in which case the preferred width and/or height is replaced by the UI's
minimum size.
Returns: the preferred size for the JEditorPane
true
when a Viewport should force the height of
this component to match the viewport height. This is implemented to return
true
when the parent is an instance of JViewport and
the viewport height > the UI's minimum height.
Returns: true
when a Viewport should force the height of
this component to match the viewport height
true
when a Viewport should force the width of
this component to match the viewport width. This is implemented to return
true
when the parent is an instance of JViewport and
the viewport width > the UI's minimum width.
Returns: true
when a Viewport should force the width of
this component to match the viewport width
Parameters: type the content type classname the name of the class that is associated with this content type
HyperlinkListener
object to this editor pane.
Parameters: listener the listener to remove
Parameters: type the content type k the EditorKit to use for the given content type
t
is expected to be in the format of the current EditorKit. This removes
the content of the current document and uses the EditorKit to read in the
new text. This allows the EditorKit to handle the String rather than just
inserting in plain text.
Parameters: t the text to display in this JEditorPane