java.lang.Object
javax.swing.text.EditorKit
javax.swing.text.DefaultEditorKit
javax.swing.text.StyledEditorKit
- All Implemented Interfaces:
- Serializable,- Cloneable
- Direct Known Subclasses:
- HTMLEditorKit,- RTFEditorKit
public class StyledEditorKit extends DefaultEditorKit
This is the set of things needed by a text component
 to be a reasonably functioning editor for some type
 of text document.  This implementation provides a default
 implementation which treats text as styled text and
 provides a minimal set of actions for editing styled text.
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classStyledEditorKit.AlignmentActionAn action to set paragraph alignment.static classStyledEditorKit.BoldActionAn action to toggle the bold attribute.static classStyledEditorKit.FontFamilyActionAn action to set the font family in the associated JEditorPane.static classStyledEditorKit.FontSizeActionAn action to set the font size in the associated JEditorPane.static classStyledEditorKit.ForegroundActionAn action to set foreground color.static classStyledEditorKit.ItalicActionAn action to toggle the italic attribute.static classStyledEditorKit.StyledTextActionAn action that assumes it's being fired on a JEditorPane with a StyledEditorKit (or subclass) installed.static classStyledEditorKit.UnderlineActionAn action to toggle the underline attribute.Nested classes/interfaces declared in class javax.swing.text.DefaultEditorKitDefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteAction
- 
Field SummaryFields declared in class javax.swing.text.DefaultEditorKitbackwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deleteNextWordAction, deletePrevCharAction, deletePrevWordAction, 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 SummaryConstructors Constructor Description StyledEditorKit()Creates a new EditorKit used for styled documents.
- 
Method SummaryModifier and Type Method Description Objectclone()Creates a copy of the editor kit.DocumentcreateDefaultDocument()Creates an uninitialized text storage model that is appropriate for this type of editor.protected voidcreateInputAttributes(Element element, MutableAttributeSet set)Copies the key/values inelements AttributeSet intoset.voiddeinstall(JEditorPane c)Called when the kit is being removed from the JEditorPane.Action[]getActions()Fetches the command list for the editor.ElementgetCharacterAttributeRun()Fetches the element representing the current run of character attributes for the caret.MutableAttributeSetgetInputAttributes()Gets the input attributes for the pane.ViewFactorygetViewFactory()Fetches a factory that is suitable for producing views of any models that are produced by this kit.voidinstall(JEditorPane c)Called when the kit is being installed into a JEditorPane.Methods declared in class javax.swing.text.DefaultEditorKitcreateCaret, getContentType, read, read, write, write
- 
Constructor Details- 
StyledEditorKitpublic StyledEditorKit()Creates a new EditorKit used for styled documents.
 
- 
- 
Method Details- 
getInputAttributesGets the input attributes for the pane. When the caret moves and there is no selection, the input attributes are automatically mutated to reflect the character attributes of the current caret location. The styled editing actions use the input attributes to carry out their actions.- Returns:
- the attribute set
 
- 
getCharacterAttributeRunFetches the element representing the current run of character attributes for the caret.- Returns:
- the element
 
- 
getActionsFetches the command list for the editor. This is the list of commands supported by the superclass augmented by the collection of commands defined locally for style operations.- Overrides:
- getActionsin class- DefaultEditorKit
- Returns:
- the command list
 
- 
createDefaultDocumentCreates an uninitialized text storage model that is appropriate for this type of editor.- Overrides:
- createDefaultDocumentin class- DefaultEditorKit
- Returns:
- the model
 
- 
installCalled when the kit is being installed into a JEditorPane.
- 
deinstallCalled when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached.
- 
getViewFactoryFetches a factory that is suitable for producing views of any models that are produced by this kit. This is implemented to return View implementations for the following kinds of elements:- AbstractDocument.ContentElementName
- AbstractDocument.ParagraphElementName
- AbstractDocument.SectionElementName
- StyleConstants.ComponentElementName
- StyleConstants.IconElementName
 - Overrides:
- getViewFactoryin class- DefaultEditorKit
- Returns:
- the factory
 
- 
cloneCreates a copy of the editor kit.
- 
createInputAttributesCopies the key/values inelements AttributeSet intoset. This does not copy component, icon, or element names attributes. Subclasses may wish to refine what is and what isn't copied here. But be sure to first remove all the attributes that are inset.This is called anytime the caret moves over a different location. - Parameters:
- element- the element
- set- the attributes
 
 
-