Class RTFEditorKit
java.lang.Object
javax.swing.text.EditorKit
javax.swing.text.DefaultEditorKit
javax.swing.text.StyledEditorKit
javax.swing.text.rtf.RTFEditorKit
- All Implemented Interfaces:
Serializable, Cloneable
This is the default implementation of RTF editing
functionality. The RTF support was not written by the
Swing team. In the future we hope to improve the support
provided.
-
Nested Class Summary
Nested classes/interfaces declared in class StyledEditorKit
StyledEditorKit.AlignmentAction, StyledEditorKit.BoldAction, StyledEditorKit.FontFamilyAction, StyledEditorKit.FontSizeAction, StyledEditorKit.ForegroundAction, StyledEditorKit.ItalicAction, StyledEditorKit.StyledTextAction, StyledEditorKit.UnderlineAction
Modifier and TypeClassDescriptionstatic class
An action to set paragraph alignment.static class
An action to toggle the bold attribute.static class
An action to set the font family in the associated JEditorPane.static class
An action to set the font size in the associated JEditorPane.static class
An action to set foreground color.static class
An action to toggle the italic attribute.static class
An action that assumes it's being fired on a JEditorPane with a StyledEditorKit (or subclass) installed.static class
An action to toggle the underline attribute.Nested classes/interfaces declared in class DefaultEditorKit
DefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteAction
Modifier and TypeClassDescriptionstatic class
Creates a beep.static class
Copies the selected region and place its contents into the system clipboard.static class
Cuts the selected region and place its contents into the system clipboard.static class
The action that is executed by default if a key typed event is received and there is no keymap entry.static class
Places a line/paragraph break into the document.static class
Places content into the associated document.static class
Places a tab character into the document.static class
Pastes the contents of the system clipboard into the selected region, or before the caret if nothing is selected. -
Field Summary
Fields declared in class DefaultEditorKit
backwardAction, beepAction, beginAction, beginLineAction, beginLineUpAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deleteNextWordAction, deletePrevCharAction, deletePrevWordAction, downAction, endAction, endLineAction, endLineDownAction, 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
Modifier and TypeFieldDescriptionstatic final String
Name of the Action for moving the caret logically backward one position.static final String
Name of the action to create a beep.static final String
Name of theAction
for moving the caret to the beginning of the document.static final String
Name of theAction
for moving the caret to the beginning of a line.static final String
Name of theAction
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
Name of theAction
for moving the caret to the beginning of a paragraph.static final String
Name of theAction
for moving the caret to the beginning of a word.static final String
Name of the action to copy the selected region and place the contents into the system clipboard.static final String
Name of the action to cut the selected region and place the contents into the system clipboard.static final String
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
Name of the action to delete the character of content that follows the current caret position.static final String
Name of the action to delete the word that follows the beginning of the selection.static final String
Name of the action to delete the character of content that precedes the current caret position.static final String
Name of the action to delete the word that precedes the beginning of the selection.static final String
Name of the Action for moving the caret logically downward one position.static final String
Name of theAction
for moving the caret to the end of the document.static final String
Name of theAction
for moving the caret to the end of a line.static final String
Name of theAction
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
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
Name of theAction
for moving the caret to the end of a paragraph.static final String
Name of the Action for moving the caret to the end of a word.static final String
Name of the Action for moving the caret logically forward one position.static final String
Name of the action to place a line/paragraph break into the document.static final String
Name of the action to place content into the associated document.static final String
Name of the action to place a tab character into the document.static final String
Name of theAction
for moving the caret to the beginning of the next word.static final String
Name of the action to page down vertically.static final String
Name of the action to page up vertically.static final String
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
Name of theAction
for moving the caret to the beginning of the previous word.static final String
Name of the action to set the editor into read-only mode.static final String
Name of the Action for selecting the entire documentstatic final String
Name of the Action for extending the selection by moving the caret logically backward one position.static final String
Name of theAction
for moving the caret to the beginning of the document.static final String
Name of theAction
for moving the caret to the beginning of a line, extending the selection.static final String
Name of theAction
for moving the caret to the beginning of a paragraph, extending the selection.static final String
Name of theAction
for moving the caret to the beginning of a word, extending the selection.static final String
Name of the Action for moving the caret logically downward one position, extending the selection.static final String
Name of the Action for moving the caret to the end of the document.static final String
Name of theAction
for moving the caret to the end of a line, extending the selection.static final String
Name of theAction
for moving the caret to the end of a paragraph, extending the selection.static final String
Name of the Action for moving the caret to the end of a word, extending the selection.static final String
Name of the Action for extending the selection by moving the caret logically forward one position.static final String
Name of theAction
for moving the selection to the beginning of the next word, extending the selection.static final String
Name of theAction
for moving the selection to the beginning of the previous word, extending the selection.static final String
Name of the Action for moving the caret logically upward one position, extending the selection.static final String
Name of the Action for selecting a line around the caret.static final String
Name of the Action for selecting a paragraph around the caret.static final String
Name of the Action for selecting a word around the caret.static final String
Name of the Action for moving the caret logically upward one position.static final String
Name of the action to set the editor into writeable mode. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the MIME type of the data that this kit represents support for.void
read
(InputStream in, Document doc, int pos) Insert content from the given stream which is expected to be in a format appropriate for this kind of content handler.void
Insert content from the given stream, which will be treated as plain text.void
write
(OutputStream out, Document doc, int pos, int len) Write content from a document to the given stream in a format appropriate for this kind of content handler.void
Write content from a document to the given stream as plain text.Methods declared in class StyledEditorKit
clone, createDefaultDocument, createInputAttributes, deinstall, getActions, getCharacterAttributeRun, getInputAttributes, getViewFactory, install
Modifier and TypeMethodDescriptionclone()
Creates a copy of the editor kit.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
Called when the kit is being removed from the JEditorPane.Action[]
Fetches the command list for the editor.Fetches the element representing the current run of character attributes for the caret.Gets the input attributes for the pane.Fetches a factory that is suitable for producing views of any models that are produced by this kit.void
Called when the kit is being installed into a JEditorPane.Methods declared in class DefaultEditorKit
createCaret
Modifier and TypeMethodDescriptionFetches a caret that can navigate through views produced by the associated ViewFactory.Methods declared in class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionboolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
RTFEditorKit
public RTFEditorKit()Constructs an RTFEditorKit.
-
-
Method Details
-
getContentType
Get the MIME type of the data that this kit represents support for. This kit supports the typetext/rtf
.- Overrides:
getContentType
in classDefaultEditorKit
- Returns:
- the type
-
read
Insert content from the given stream which is expected to be in a format appropriate for this kind of content handler.- Overrides:
read
in classDefaultEditorKit
- Parameters:
in
- The stream to read fromdoc
- The destination for the insertion.pos
- The location in the document to place the content.- Throws:
IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.
-
write
public void write(OutputStream out, Document doc, int pos, int len) throws IOException, BadLocationException Write content from a document to the given stream in a format appropriate for this kind of content handler.- Overrides:
write
in classDefaultEditorKit
- Parameters:
out
- The stream to write todoc
- The source for the write.pos
- The location in the document to fetch the content.len
- The amount to write out.- Throws:
IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.
-
read
Insert content from the given stream, which will be treated as plain text.- Overrides:
read
in classDefaultEditorKit
- Parameters:
in
- The stream to read fromdoc
- The destination for the insertion.pos
- The location in the document to place the content.- Throws:
IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.
-
write
public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException Write content from a document to the given stream as plain text.- Overrides:
write
in classDefaultEditorKit
- Parameters:
out
- The stream to write todoc
- The source for the write.pos
- The location in the document to fetch the content.len
- The amount to write out.- Throws:
IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.
-