public class StyledEditorKit extends DefaultEditorKit
EditorKit that supports editing styled text.| Modifier and Type | Class and Description |
|---|---|
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.
|
static class |
StyledEditorKit.StyledTextAction
The abstract superclass of all styled TextActions.
|
static class |
StyledEditorKit.UnderlineAction
Toggles the underline attribute for the selected text.
|
DefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteActionbackwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deletePrevCharAction, downAction, endAction, endLineAction, EndOfLineStringProperty, endParagraphAction, endWordAction, forwardAction, insertBreakAction, insertContentAction, insertTabAction, nextWordAction, pageDownAction, pageUpAction, pasteAction, previousWordAction, readOnlyAction, selectAllAction, selectionBackwardAction, selectionBeginAction, selectionBeginLineAction, selectionBeginParagraphAction, selectionBeginWordAction, selectionDownAction, selectionEndAction, selectionEndLineAction, selectionEndParagraphAction, selectionEndWordAction, selectionForwardAction, selectionNextWordAction, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, upAction, writableAction| Constructor and Description |
|---|
StyledEditorKit()
Creates a new instance of
StyledEditorKit. |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates an exact copy of this
StyledEditorKit. |
Document |
createDefaultDocument()
Creates the default
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
JEditorPane. |
Action[] |
getActions()
Returns the
Actions supported by this EditorKit. |
Element |
getCharacterAttributeRun()
Returns the
Element that represents the character run at the
current caret position. |
MutableAttributeSet |
getInputAttributes()
Returns the current input attributes.
|
ViewFactory |
getViewFactory()
Returns a
ViewFactory that is able to create Views
for Elements that are supported by this EditorKit,
namely the following types of Elements:
AbstractDocument.ContentElementName
AbstractDocument.ParagraphElementName
AbstractDocument.SectionElementName
StyleConstants.ComponentElementName
StyleConstants.IconElementName
|
void |
install(JEditorPane component)
Installs this
EditorKit on the specified JEditorPane. |
createCaret, getContentType, read, read, write, writepublic StyledEditorKit()
StyledEditorKit.public Action[] getActions()
Actions supported by this EditorKit.
This includes the StyledEditorKit.BoldAction, StyledEditorKit.ItalicAction and
StyledEditorKit.UnderlineAction as well as the Actions supported
by DefaultEditorKit.
The other Actions of StyledEditorKit are not
returned here, since they require a parameter and thus custom
instantiation.getActions in class DefaultEditorKitActions supported by this EditorKitpublic MutableAttributeSet getInputAttributes()
public Element getCharacterAttributeRun()
Element that represents the character run at the
current caret position.Element that represents the character run at the
current caret positionpublic Document createDefaultDocument()
Document supported by this
EditorKit. This is an instance of
DefaultStyledDocument in this case but may be overridden by
subclasses.createDefaultDocument in class DefaultEditorKitDefaultStyledDocumentpublic void install(JEditorPane component)
EditorKit on the specified JEditorPane.
This basically involves setting up required listeners on the
JEditorPane.public void deinstall(JEditorPane component)
EditorKit from the specified
JEditorPane. This basically involves removing all listeners from
JEditorPane that have been set up by this
EditorKit.public ViewFactory getViewFactory()
ViewFactory that is able to create Views
for Elements that are supported by this EditorKit,
namely the following types of Elements:
getViewFactory in class DefaultEditorKitViewFactory that is able to create Views
for Elements that are supported by this EditorKitprotected void createInputAttributes(Element element, MutableAttributeSet set)
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, Icons
and Components.element - the Element from which to copy the text
attributesset - the inputAttributes to copy the attributes to