javax.swing.text
public class StyledEditorKit extends DefaultEditorKit
Nested Class Summary | |
---|---|
static class | StyledEditorKit.AlignmentAction
Sets the alignment attribute on the selected text. |
static class | StyledEditorKit.BoldAction
Toggles the bold attribute for the selected text. |
static class | StyledEditorKit.FontFamilyAction
Sets the font family attribute on the selected text. |
static class | StyledEditorKit.FontSizeAction
Sets the font size attribute on the selected text. |
static class | StyledEditorKit.ForegroundAction
Sets the foreground color attribute on the selected text. |
static class | StyledEditorKit.ItalicAction
Toggles the italic attribute for the selected text. |
abstract static class | StyledEditorKit.StyledTextAction
The abstract superclass of all styled TextActions. |
static class | StyledEditorKit.UnderlineAction
Toggles the underline attribute for the selected text. |
Constructor Summary | |
---|---|
StyledEditorKit()
Creates a new instance of StyledEditorKit . |
Method Summary | |
---|---|
Object | clone()
Creates an exact copy of this StyledEditorKit .
|
Document | createDefaultDocument()
Creates the default {@link Document} supported by this
EditorKit . |
protected void | createInputAttributes(Element element, MutableAttributeSet set)
Copies the text attributes from element to set .
|
void | deinstall(JEditorPane component)
Deinstalls this EditorKit from the specified
{@link JEditorPane}. |
Action[] | getActions()
Returns the Action s supported by this {@link EditorKit}.
|
Element | getCharacterAttributeRun()
Returns the {@link Element} that represents the character run at the
current caret position.
|
MutableAttributeSet | getInputAttributes()
Returns the current input attributes. |
ViewFactory | getViewFactory()
Returns a {@link ViewFactory} that is able to create {@link View}s
for {@link Element}s that are supported by this EditorKit ,
namely the following types of Element s:
|
void | install(JEditorPane component)
Installs this EditorKit on the specified {@link JEditorPane}.
|
StyledEditorKit
.StyledEditorKit
.
Returns: an exact copy of this StyledEditorKit
EditorKit
. This is an instance of
{@link DefaultStyledDocument} in this case but may be overridden by
subclasses.
Returns: an instance of DefaultStyledDocument
element
to set
.
This is called everytime when the caret position changes to keep
track of the current input attributes. The attributes in set
are cleaned before adding the attributes of element
.
This method filters out attributes for element names, Icon
s
and Component
s.
Parameters: element the Element
from which to copy the text
attributes set the inputAttributes to copy the attributes to
EditorKit
from the specified
{@link JEditorPane}. This basically involves removing all listeners from
JEditorPane
that have been set up by this
EditorKit
.
Parameters: component the JEditorPane
from which to deinstall this
EditorKit
Action
s supported by this {@link EditorKit}.
This includes the {@link BoldAction}, {@link ItalicAction} and
{@link UnderlineAction} as well as the Action
s supported
by {@link DefaultEditorKit}.
The other Action
s of StyledEditorKit
are not
returned here, since they require a parameter and thus custom
instantiation.
Returns: the Action
s supported by this {@link EditorKit}
Returns: the {@link Element} that represents the character run at the current caret position
Returns: the current input attributes
EditorKit
,
namely the following types of Element
s:
Returns: a {@link ViewFactory} that is able to create {@link View}s
for {@link Element}s that are supported by this EditorKit
EditorKit
on the specified {@link JEditorPane}.
This basically involves setting up required listeners on the
JEditorPane
.
Parameters: component the JEditorPane
to install this
EditorKit
on