- 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 Summary
Nested Classes Modifier and Type Class and Description static class
StyledEditorKit.AlignmentAction
An action to set paragraph alignment.static class
StyledEditorKit.BoldAction
An action to toggle the bold attribute.static class
StyledEditorKit.FontFamilyAction
An action to set the font family in the associated JEditorPane.static class
StyledEditorKit.FontSizeAction
An action to set the font size in the associated JEditorPane.static class
StyledEditorKit.ForegroundAction
An action to set foreground color.static class
StyledEditorKit.ItalicAction
An action to toggle the italic attribute.static class
StyledEditorKit.StyledTextAction
An action that assumes it's being fired on a JEditorPane with a StyledEditorKit (or subclass) installed.static class
StyledEditorKit.UnderlineAction
An action to toggle the underline attribute.-
Nested classes/interfaces inherited from class javax.swing.text.DefaultEditorKit
DefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteAction
-
-
Field Summary
-
Fields inherited from class javax.swing.text.DefaultEditorKit
backwardAction, 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 Summary
Constructors Constructor and Description StyledEditorKit()
Creates a new EditorKit used for styled documents.
-
Method Summary
Methods Modifier and Type Method and Description Object
clone()
Creates a copy of the editor kit.Document
createDefaultDocument()
Creates an uninitialized text storage model that is appropriate for this type of editor.protected void
createInputAttributes(Element element, MutableAttributeSet set)
Copies the key/values inelement
s AttributeSet intoset
.void
deinstall(JEditorPane c)
Called when the kit is being removed from the JEditorPane.Action[]
getActions()
Fetches the command list for the editor.Element
getCharacterAttributeRun()
Fetches the element representing the current run of character attributes for the caret.MutableAttributeSet
getInputAttributes()
Gets the input attributes for the pane.ViewFactory
getViewFactory()
Fetches a factory that is suitable for producing views of any models that are produced by this kit.void
install(JEditorPane c)
Called when the kit is being installed into a JEditorPane.-
Methods inherited from class javax.swing.text.DefaultEditorKit
createCaret, getContentType, read, read, write, write
-
-
-
-
Constructor Detail
-
StyledEditorKit
public StyledEditorKit()
Creates a new EditorKit used for styled documents.
-
-
Method Detail
-
getInputAttributes
public MutableAttributeSet getInputAttributes()
Gets 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
-
getCharacterAttributeRun
public Element getCharacterAttributeRun()
Fetches the element representing the current run of character attributes for the caret.- Returns:
- the element
-
getActions
public Action[] getActions()
Fetches 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:
getActions
in classDefaultEditorKit
- Returns:
- the command list
-
createDefaultDocument
public Document createDefaultDocument()
Creates an uninitialized text storage model that is appropriate for this type of editor.- Overrides:
createDefaultDocument
in classDefaultEditorKit
- Returns:
- the model
-
install
public void install(JEditorPane c)
Called when the kit is being installed into a JEditorPane.
-
deinstall
public void deinstall(JEditorPane c)
Called when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached.
-
getViewFactory
public ViewFactory getViewFactory()
Fetches 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:
getViewFactory
in classDefaultEditorKit
- Returns:
- the factory
-
clone
public Object clone()
Creates a copy of the editor kit.
-
createInputAttributes
protected void createInputAttributes(Element element, MutableAttributeSet set)
Copies the key/values inelement
s 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.
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/swing/text/stylededitorkit.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.