Package Summary  Overview Summary

class:DefaultEditorKit [NONE]

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
StyledEditorKit

public class DefaultEditorKitextends EditorKit
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 plain text and provides a minimal set of actions for a simple editor.
Newlines
There are two properties which deal with newlines. The system property, line.separator, is defined to be platform-dependent, either "\n", "\r", or "\r\n". There is also a property defined in DefaultEditorKit, called EndOfLineStringProperty, which is defined automatically when a document is loaded, to be the first occurrence of any of the newline characters. When a document is loaded, EndOfLineStringProperty is set appropriately, and when the document is written back out, the EndOfLineStringProperty is used. But while the document is in memory, the "\n" character is used to define a newline, regardless of how the newline is defined when the document is on disk. Therefore, for searching purposes, "\n" should always be used. When a new document is created, and the EndOfLineStringProperty has not been defined, it will use the System property when writing out the document.

Note that EndOfLineStringProperty is set on the Document using the get/putProperty methods. Subclasses may override this behavior.

field:EndOfLineStringProperty [NONE]

  • EndOfLineStringProperty

    public static final  String EndOfLineStringProperty
    When reading a document if a CRLF is encountered a property with this name is added and the value will be "\r\n".
    See Also:
  • field:insertContentAction [NONE]

    insertContentAction

    public static final  String insertContentAction
    Name of the action to place content into the associated document. If there is a selection, it is removed before the new content is added.
    See Also:

    field:insertBreakAction [NONE]

    insertBreakAction

    public static final  String insertBreakAction
    Name of the action to place a line/paragraph break into the document. If there is a selection, it is removed before the break is added.
    See Also:

    field:insertTabAction [NONE]

    insertTabAction

    public static final  String insertTabAction
    Name of the action to place a tab character into the document. If there is a selection, it is removed before the tab is added.
    See Also:

    field:deletePrevCharAction [NONE]

    deletePrevCharAction

    public static final  String deletePrevCharAction
    Name of the action to delete the character of content that precedes the current caret position.
    See Also:

    field:deleteNextCharAction [NONE]

    deleteNextCharAction

    public static final  String deleteNextCharAction
    Name of the action to delete the character of content that follows the current caret position.
    See Also:

    field:deleteNextWordAction [NONE]

    deleteNextWordAction

    public static final  String deleteNextWordAction
    Name of the action to delete the word that follows the beginning of the selection.
    Since:
    1.6
    See Also:

    field:deletePrevWordAction [NONE]

    deletePrevWordAction

    public static final  String deletePrevWordAction
    Name of the action to delete the word that precedes the beginning of the selection.
    Since:
    1.6
    See Also:

    field:readOnlyAction [NONE]

    readOnlyAction

    public static final  String readOnlyAction
    Name of the action to set the editor into read-only mode.
    See Also:

    field:writableAction [NONE]

    writableAction

    public static final  String writableAction
    Name of the action to set the editor into writeable mode.
    See Also:

    field:cutAction [NONE]

    cutAction

    public static final  String cutAction
    Name of the action to cut the selected region and place the contents into the system clipboard.
    See Also:

    field:copyAction [NONE]

    copyAction

    public static final  String copyAction
    Name of the action to copy the selected region and place the contents into the system clipboard.
    See Also:

    field:pasteAction [NONE]

    pasteAction

    public static final  String pasteAction
    Name of the action to paste the contents of the system clipboard into the selected region, or before the caret if nothing is selected.
    See Also:

    field:beepAction [NONE]

    beepAction

    public static final  String beepAction
    Name of the action to create a beep.
    See Also:

    field:pageUpAction [NONE]

    pageUpAction

    public static final  String pageUpAction
    Name of the action to page up vertically.
    See Also:

    field:pageDownAction [NONE]

    pageDownAction

    public static final  String pageDownAction
    Name of the action to page down vertically.
    See Also:

    field:forwardAction [NONE]

    forwardAction

    public static final  String forwardAction
    Name of the Action for moving the caret logically forward one position.
    See Also:

    field:backwardAction [NONE]

    backwardAction

    public static final  String backwardAction
    Name of the Action for moving the caret logically backward one position.
    See Also:

    field:selectionForwardAction [NONE]

    selectionForwardAction

    public static final  String selectionForwardAction
    Name of the Action for extending the selection by moving the caret logically forward one position.
    See Also:

    field:selectionBackwardAction [NONE]

    selectionBackwardAction

    public static final  String selectionBackwardAction
    Name of the Action for extending the selection by moving the caret logically backward one position.
    See Also:

    field:upAction [NONE]

    upAction

    public static final  String upAction
    Name of the Action for moving the caret logically upward one position.
    See Also:

    field:downAction [NONE]

    downAction

    public static final  String downAction
    Name of the Action for moving the caret logically downward one position.
    See Also:

    field:selectionUpAction [NONE]

    selectionUpAction

    public static final  String selectionUpAction
    Name of the Action for moving the caret logically upward one position, extending the selection.
    See Also:

    field:selectionDownAction [NONE]

    selectionDownAction

    public static final  String selectionDownAction
    Name of the Action for moving the caret logically downward one position, extending the selection.
    See Also:

    field:beginWordAction [NONE]

    beginWordAction

    public static final  String beginWordAction
    Name of the Action for moving the caret to the beginning of a word.
    See Also:

    field:endWordAction [NONE]

    endWordAction

    public static final  String endWordAction
    Name of the Action for moving the caret to the end of a word.
    See Also:

    field:selectionBeginWordAction [NONE]

    selectionBeginWordAction

    public static final  String selectionBeginWordAction
    Name of the Action for moving the caret to the beginning of a word, extending the selection.
    See Also:

    field:selectionEndWordAction [NONE]

    selectionEndWordAction

    public static final  String selectionEndWordAction
    Name of the Action for moving the caret to the end of a word, extending the selection.
    See Also:

    field:previousWordAction [NONE]

    previousWordAction

    public static final  String previousWordAction
    Name of the Action for moving the caret to the beginning of the previous word.
    See Also:

    field:nextWordAction [NONE]

    nextWordAction

    public static final  String nextWordAction
    Name of the Action for moving the caret to the beginning of the next word.
    See Also:

    field:selectionPreviousWordAction [NONE]

    selectionPreviousWordAction

    public static final  String selectionPreviousWordAction
    Name of the Action for moving the selection to the beginning of the previous word, extending the selection.
    See Also:

    field:selectionNextWordAction [NONE]

    selectionNextWordAction

    public static final  String selectionNextWordAction
    Name of the Action for moving the selection to the beginning of the next word, extending the selection.
    See Also:

    field:beginLineAction [NONE]

    beginLineAction

    public static final  String beginLineAction
    Name of the Action for moving the caret to the beginning of a line.
    See Also:

    field:endLineAction [NONE]

    endLineAction

    public static final  String endLineAction
    Name of the Action for moving the caret to the end of a line.
    See Also:

    field:beginLineUpAction [ADDED]

    beginLineUpAction

    public static final  String beginLineUpAction
    Name of the Action for moving the caret to the beginning of the current line or up to the beginning of the previous line if the caret is already at the beginning of the line.
    See Also:

    field:endLineDownAction [ADDED]

    endLineDownAction

    public static final  String endLineDownAction
    Name of the Action for moving the caret to the end of the current line or down to the end of the next line if the caret is already at the end of the line.
    See Also:

    field:selectionBeginLineAction [NONE]

    selectionBeginLineAction

    public static final  String selectionBeginLineAction
    Name of the Action for moving the caret to the beginning of a line, extending the selection.
    See Also:

    field:selectionEndLineAction [NONE]

    selectionEndLineAction

    public static final  String selectionEndLineAction
    Name of the Action for moving the caret to the end of a line, extending the selection.
    See Also:

    field:beginParagraphAction [NONE]

    beginParagraphAction

    public static final  String beginParagraphAction
    Name of the Action for moving the caret to the beginning of a paragraph.
    See Also:

    field:endParagraphAction [NONE]

    endParagraphAction

    public static final  String endParagraphAction
    Name of the Action for moving the caret to the end of a paragraph.
    See Also:

    field:selectionBeginParagraphAction [NONE]

    selectionBeginParagraphAction

    public static final  String selectionBeginParagraphAction
    Name of the Action for moving the caret to the beginning of a paragraph, extending the selection.
    See Also:

    field:selectionEndParagraphAction [NONE]

    selectionEndParagraphAction

    public static final  String selectionEndParagraphAction
    Name of the Action for moving the caret to the end of a paragraph, extending the selection.
    See Also:

    field:beginAction [NONE]

    beginAction

    public static final  String beginAction
    Name of the Action for moving the caret to the beginning of the document.
    See Also:

    field:endAction [NONE]

    endAction

    public static final  String endAction
    Name of the Action for moving the caret to the end of the document.
    See Also:

    field:selectionBeginAction [NONE]

    selectionBeginAction

    public static final  String selectionBeginAction
    Name of the Action for moving the caret to the beginning of the document.
    See Also:

    field:selectionEndAction [NONE]

    selectionEndAction

    public static final  String selectionEndAction
    Name of the Action for moving the caret to the end of the document.
    See Also:

    field:selectWordAction [NONE]

    selectWordAction

    public static final  String selectWordAction
    Name of the Action for selecting a word around the caret.
    See Also:

    field:selectLineAction [NONE]

    selectLineAction

    public static final  String selectLineAction
    Name of the Action for selecting a line around the caret.
    See Also:

    field:selectParagraphAction [NONE]

    selectParagraphAction

    public static final  String selectParagraphAction
    Name of the Action for selecting a paragraph around the caret.
    See Also:

    field:selectAllAction [NONE]

    selectAllAction

    public static final  String selectAllAction
    Name of the Action for selecting the entire document
    See Also:

    field:defaultKeyTypedAction [NONE]

    defaultKeyTypedAction

    public static final  String defaultKeyTypedAction
    Name of the action that is executed by default if a key typed event is received and there is no keymap entry.
    See Also:

    constructor:DefaultEditorKit() [NONE]

    • DefaultEditorKit

      public DefaultEditorKit()
      default constructor for DefaultEditorKit

    method:getContentType() [NONE]

  • getContentType

    public String getContentType()
    Gets the MIME type of the data that this kit represents support for. The default is text/plain.
    Specified by:
    getContentType in class EditorKit
    Returns:
    the type
  • method:getViewFactory() [NONE]

    getViewFactory

    public ViewFactory getViewFactory()
    Fetches a factory that is suitable for producing views of any models that are produced by this kit. The default is to have the UI produce the factory, so this method has no implementation.
    Specified by:
    getViewFactory in class EditorKit
    Returns:
    the view factory

    method:getActions() [NONE]

    getActions

    public Action[] getActions()
    Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.
    Specified by:
    getActions in class EditorKit
    Returns:
    the command list

    method:createCaret() [NONE]

    createCaret

    public Caret createCaret()
    Fetches a caret that can navigate through views produced by the associated ViewFactory.
    Specified by:
    createCaret in class EditorKit
    Returns:
    the caret

    method:createDefaultDocument() [NONE]

    createDefaultDocument

    public Document createDefaultDocument()
    Creates an uninitialized text storage model (PlainDocument) that is appropriate for this type of editor.
    Specified by:
    createDefaultDocument in class EditorKit
    Returns:
    the model

    method:read(java.io.InputStream,javax.swing.text.Document,int) [NONE]

    read

    public void read (InputStream in, Document doc, int pos) throws IOException, BadLocationException
    Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
    Specified by:
    read in class EditorKit
    Parameters:
    in - The stream to read from
    doc - The destination for the insertion.
    pos - The location in the document to place the content >=0.
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:write(java.io.OutputStream,javax.swing.text.Document,int,int) [NONE]

    write

    public void write (OutputStream out, Document doc, int pos, int len) throws IOException, BadLocationException
    Writes content from a document to the given stream in a format appropriate for this kind of content handler.
    Specified by:
    write in class EditorKit
    Parameters:
    out - The stream to write to
    doc - The source for the write.
    pos - The location in the document to fetch the content >=0.
    len - The amount to write out >=0.
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:read(java.io.Reader,javax.swing.text.Document,int) [NONE]

    read

    public void read (Reader in, Document doc, int pos) throws IOException, BadLocationException
    Inserts content from the given stream, which will be treated as plain text.
    Specified by:
    read in class EditorKit
    Parameters:
    in - The stream to read from
    doc - The destination for the insertion.
    pos - The location in the document to place the content >=0.
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:write(java.io.Writer,javax.swing.text.Document,int,int) [NONE]

    write

    public void write (Writer out, Document doc, int pos, int len) throws IOException, BadLocationException
    Writes content from a document to the given stream as plain text.
    Specified by:
    write in class EditorKit
    Parameters:
    out - The stream to write to
    doc - The source for the write.
    pos - The location in the document to fetch the content from >=0.
    len - The amount to write out >=0.
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos is not within 0 and the length of the document.

    © 2023 Oracle Corporation and/or its affiliates