Serializable
, Cloneable
StyledEditorKit
public class DefaultEditorKit extends EditorKit
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.
Modifier and Type | Class | Description |
---|---|---|
static class |
DefaultEditorKit.BeepAction |
Creates a beep. |
static class |
DefaultEditorKit.CopyAction |
Copies the selected region and place its contents into the system clipboard. |
static class |
DefaultEditorKit.CutAction |
Cuts the selected region and place its contents into the system clipboard. |
static class |
DefaultEditorKit.DefaultKeyTypedAction |
The action that is executed by default if a key typed event is received and there is no keymap entry. |
static class |
DefaultEditorKit.InsertBreakAction |
Places a line/paragraph break into the document. |
static class |
DefaultEditorKit.InsertContentAction |
Places content into the associated document. |
static class |
DefaultEditorKit.InsertTabAction |
Places a tab character into the document. |
static class |
DefaultEditorKit.PasteAction |
Pastes the contents of the system clipboard into the selected region, or before the caret if nothing is selected. |
Modifier and Type | Field | Description |
---|---|---|
static final String |
backwardAction |
Name of the Action for moving the caret logically backward one position. |
static final String |
beepAction |
Name of the action to create a beep. |
static final String |
beginAction |
Name of the Action for moving the caret to the beginning of the document. |
static final String |
beginLineAction |
Name of the Action for moving the caret to the beginning of a line. |
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. |
static final String |
beginParagraphAction |
Name of the Action for moving the caret to the beginning of a paragraph. |
static final String |
beginWordAction |
Name of the Action for moving the caret to the beginning of a word. |
static final String |
copyAction |
Name of the action to copy the selected region and place the contents into the system clipboard. |
static final String |
cutAction |
Name of the action to cut the selected region and place the contents into the system clipboard. |
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. |
static final String |
deleteNextCharAction |
Name of the action to delete the character of content that follows the current caret position. |
static final String |
deleteNextWordAction |
Name of the action to delete the word that follows the beginning of the selection. |
static final String |
deletePrevCharAction |
Name of the action to delete the character of content that precedes the current caret position. |
static final String |
deletePrevWordAction |
Name of the action to delete the word that precedes the beginning of the selection. |
static final String |
downAction |
Name of the Action for moving the caret logically downward one position. |
static final String |
endAction |
Name of the Action for moving the caret to the end of the document. |
static final String |
endLineAction |
Name of the Action for moving the caret to the end of a line. |
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. |
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". |
static final String |
endParagraphAction |
Name of the Action for moving the caret to the end of a paragraph. |
static final String |
endWordAction |
Name of the Action for moving the caret to the end of a word. |
static final String |
forwardAction |
Name of the Action for moving the caret logically forward one position. |
static final String |
insertBreakAction |
Name of the action to place a line/paragraph break into the document. |
static final String |
insertContentAction |
Name of the action to place content into the associated document. |
static final String |
insertTabAction |
Name of the action to place a tab character into the document. |
static final String |
nextWordAction |
Name of the Action for moving the caret to the beginning of the next word. |
static final String |
pageDownAction |
Name of the action to page down vertically. |
static final String |
pageUpAction |
Name of the action to page up vertically. |
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. |
static final String |
previousWordAction |
Name of the Action for moving the caret to the beginning of the previous word. |
static final String |
readOnlyAction |
Name of the action to set the editor into read-only mode. |
static final String |
selectAllAction |
Name of the Action for selecting the entire document |
static final String |
selectionBackwardAction |
Name of the Action for extending the selection by moving the caret logically backward one position. |
static final String |
selectionBeginAction |
Name of the Action for moving the caret to the beginning of the document. |
static final String |
selectionBeginLineAction |
Name of the Action for moving the caret to the beginning of a line, extending the selection. |
static final String |
selectionBeginParagraphAction |
Name of the Action for moving the caret to the beginning of a paragraph, extending the selection. |
static final String |
selectionBeginWordAction |
Name of the Action for moving the caret to the beginning of a word, extending the selection. |
static final String |
selectionDownAction |
Name of the Action for moving the caret logically downward one position, extending the selection. |
static final String |
selectionEndAction |
Name of the Action for moving the caret to the end of the document. |
static final String |
selectionEndLineAction |
Name of the Action for moving the caret to the end of a line, extending the selection. |
static final String |
selectionEndParagraphAction |
Name of the Action for moving the caret to the end of a paragraph, extending the selection. |
static final String |
selectionEndWordAction |
Name of the Action for moving the caret to the end of a word, extending the selection. |
static final String |
selectionForwardAction |
Name of the Action for extending the selection by moving the caret logically forward one position. |
static final String |
selectionNextWordAction |
Name of the Action for moving the selection to the beginning of the next word, extending the selection. |
static final String |
selectionPreviousWordAction |
Name of the Action for moving the selection to the beginning of the previous word, extending the selection. |
static final String |
selectionUpAction |
Name of the Action for moving the caret logically upward one position, extending the selection. |
static final String |
selectLineAction |
Name of the Action for selecting a line around the caret. |
static final String |
selectParagraphAction |
Name of the Action for selecting a paragraph around the caret. |
static final String |
selectWordAction |
Name of the Action for selecting a word around the caret. |
static final String |
upAction |
Name of the Action for moving the caret logically upward one position. |
static final String |
writableAction |
Name of the action to set the editor into writeable mode. |
Constructor | Description |
---|---|
DefaultEditorKit() |
default constructor for DefaultEditorKit |
Modifier and Type | Method | Description |
---|---|---|
Caret |
createCaret() |
Fetches a caret that can navigate through views produced by the associated ViewFactory. |
Document |
createDefaultDocument() |
Creates an uninitialized text storage model (PlainDocument) that is appropriate for this type of editor. |
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. |
String |
getContentType() |
Gets the MIME type of the data that this kit represents support for. |
ViewFactory |
getViewFactory() |
Fetches a factory that is suitable for producing views of any models that are produced by this kit. |
void |
read |
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler. |
void |
read |
Inserts content from the given stream, which will be treated as plain text. |
void |
write |
Writes content from a document to the given stream in a format appropriate for this kind of content handler. |
void |
write |
Writes content from a document to the given stream as plain text. |
public static final String EndOfLineStringProperty
public static final String insertContentAction
public static final String insertBreakAction
public static final String insertTabAction
public static final String deletePrevCharAction
public static final String deleteNextCharAction
public static final String deleteNextWordAction
public static final String deletePrevWordAction
public static final String readOnlyAction
public static final String writableAction
public static final String cutAction
public static final String copyAction
public static final String pasteAction
public static final String beepAction
public static final String pageUpAction
public static final String pageDownAction
public static final String forwardAction
public static final String backwardAction
public static final String selectionForwardAction
public static final String selectionBackwardAction
public static final String upAction
public static final String downAction
public static final String selectionUpAction
public static final String selectionDownAction
public static final String beginWordAction
Action
for moving the caret to the beginning of a word.public static final String endWordAction
public static final String selectionBeginWordAction
Action
for moving the caret to the beginning of a word, extending the selection.public static final String selectionEndWordAction
public static final String previousWordAction
Action
for moving the caret to the beginning of the previous word.public static final String nextWordAction
Action
for moving the caret to the beginning of the next word.public static final String selectionPreviousWordAction
Action
for moving the selection to the beginning of the previous word, extending the selection.public static final String selectionNextWordAction
Action
for moving the selection to the beginning of the next word, extending the selection.public static final String beginLineAction
Action
for moving the caret to the beginning of a line.public static final String endLineAction
Action
for moving the caret to the end of a line.public static final String beginLineUpAction
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.public static final String endLineDownAction
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.public static final String selectionBeginLineAction
Action
for moving the caret to the beginning of a line, extending the selection.public static final String selectionEndLineAction
Action
for moving the caret to the end of a line, extending the selection.public static final String beginParagraphAction
Action
for moving the caret to the beginning of a paragraph.public static final String endParagraphAction
Action
for moving the caret to the end of a paragraph.public static final String selectionBeginParagraphAction
Action
for moving the caret to the beginning of a paragraph, extending the selection.public static final String selectionEndParagraphAction
Action
for moving the caret to the end of a paragraph, extending the selection.public static final String beginAction
Action
for moving the caret to the beginning of the document.public static final String endAction
Action
for moving the caret to the end of the document.public static final String selectionBeginAction
Action
for moving the caret to the beginning of the document.public static final String selectionEndAction
public static final String selectWordAction
public static final String selectLineAction
public static final String selectParagraphAction
public static final String selectAllAction
public static final String defaultKeyTypedAction
public DefaultEditorKit()
public String getContentType()
text/plain
.getContentType
in class EditorKit
public ViewFactory getViewFactory()
getViewFactory
in class EditorKit
public Action[] getActions()
getActions
in class EditorKit
public Caret createCaret()
createCaret
in class EditorKit
public Document createDefaultDocument()
createDefaultDocument
in class EditorKit
public void read(InputStream in, Document doc, int pos) throws IOException, BadLocationException
read
in class EditorKit
in
- The stream to read fromdoc
- The destination for the insertion.pos
- The location in the document to place the content >=0.IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.public void write(OutputStream out, Document doc, int pos, int len) throws IOException, BadLocationException
write
in class EditorKit
out
- The stream to write todoc
- The source for the write.pos
- The location in the document to fetch the content >=0.len
- The amount to write out >=0.IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException
read
in class EditorKit
in
- The stream to read fromdoc
- The destination for the insertion.pos
- The location in the document to place the content >=0.IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException
write
in class EditorKit
out
- The stream to write todoc
- The source for the write.pos
- The location in the document to fetch the content from >=0.len
- The amount to write out >=0.IOException
- on any I/O errorBadLocationException
- if pos is not within 0 and the length of the document.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/text/DefaultEditorKit.html