javax.swing
public class JTextPane extends JEditorPane
Constructor Summary | |
---|---|
JTextPane()
Creates a new JTextPane with a null document. | |
JTextPane(StyledDocument document)
Creates a new JTextPane and sets the specified
document .
|
Method Summary | |
---|---|
Style | addStyle(String nm, Style parent)
Adds a style into the style hierarchy. |
protected EditorKit | createDefaultEditorKit()
Creates the default {@link EditorKit} that is used in
JTextPane s. |
AttributeSet | getCharacterAttributes()
Returns the text attributes for the character at the current caret
position.
|
MutableAttributeSet | getInputAttributes()
Returns the attributes that are applied to newly inserted text.
|
Style | getLogicalStyle()
Returns the logical style of the paragraph at the current caret position.
|
AttributeSet | getParagraphAttributes()
Returns the text attributes of the paragraph at the current caret
position.
|
Style | getStyle(String nm)
Looks up and returns a named Style .
|
StyledDocument | getStyledDocument()
Returns the {@link StyledDocument} that is the content model for
this JTextPane . |
protected StyledEditorKit | getStyledEditorKit()
Returns the {@link StyledEditorKit} that is currently used by this
JTextPane .
|
String | getUIClassID()
Returns the UI class ID. |
void | insertComponent(Component component)
Inserts an AWT or Swing component into the text at the current caret
position.
|
void | insertIcon(Icon icon)
Inserts an Icon into the text at the current caret position.
|
protected String | paramString()
Returns a param string that can be used for debugging.
|
void | removeStyle(String nm)
Removes a named Style from the style hierarchy.
|
void | replaceSelection(String content)
Replaces the currently selected text with the specified
content . |
void | setCharacterAttributes(AttributeSet attribute, boolean replace)
Sets text attributes for the current selection. |
void | setDocument(Document document)
Sets the content model for this JTextPane .
|
void | setEditorKit(EditorKit editor)
Sets the {@link EditorKit} to use for this JTextPane .
|
void | setLogicalStyle(Style style)
Sets the logical style for the paragraph at the current caret position.
|
void | setParagraphAttributes(AttributeSet attribute, boolean replace)
Sets text attributes for the paragraph at the current selection.
|
void | setStyledDocument(StyledDocument document)
Sets the content model for this JTextPane .
|
JTextPane
with a null
document.JTextPane
and sets the specified
document
.
Parameters: document the content model to use
parent
style, if one is specified.
While it is legal to add nameless styles (nm == null
Parameters: nm the name of the style or null
if the style should
be unnamed parent the parent in which unspecified style attributes are
resolved, or null
if that is not necessary
Returns: the newly created Style
JTextPane
s. This is an instance of {@link StyledEditorKit}.
Returns: the default {@link EditorKit} that is used in
JTextPane
s
Returns: the text attributes for the character at the current caret position
Returns: the attributes that are applied to newly inserted text
Returns: the logical style of the paragraph at the current caret position
Returns: the attributes of the paragraph at the current caret position
Style
.
Parameters: nm the name of the Style
Returns: the found Style
of null
if no such
Style
exists
JTextPane
. This is a typed wrapper for
{@link #getDocument()}.
Returns: the content model of this JTextPane
JTextPane
.
Returns: the current StyledEditorKit
of this
JTextPane
TextPaneUI
.
Returns: TextPaneUI
Parameters: component the component to be inserted
Icon
into the text at the current caret position.
Parameters: icon the Icon
to be inserted
Returns: a param string that can be used for debugging.
Style
from the style hierarchy.
Parameters: nm the name of the Style
to be removed
content
. If there is no selected text, this results
in a simple insertion at the current caret position. If there is
no content
specified, this results in the selection
beeing deleted.
Parameters: content the text with which the selection is replaced
Parameters: attribute the text attributes to set replace if true
, the attributes of the current
selection are overridden, otherwise they are merged
See Also: JTextPane
JTextPane
.
JTextPane
can only be used with {@link StyledDocument}s,
if you try to set a different type of Document
, an
IllegalArgumentException
is thrown.
Parameters: document the content model to set
Throws: IllegalArgumentException if document
is not an
instance of StyledDocument
See Also: JTextPane
JTextPane
.
JTextPane
s can only handle {@link StyledEditorKit}s,
if client programs try to set a different type of EditorKit
then an IllegalArgumentException is thrown
Parameters: editor the EditorKit
to set
Throws: IllegalArgumentException if editor
is no
StyledEditorKit
Parameters: style the style to set for the current paragraph
Parameters: attribute the text attributes to set replace if true
, the attributes of the current
selection are overridden, otherwise they are merged
JTextPane
.
Parameters: document the content model to set