This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.text
class StyledEditorKit

java.lang.Object extended by javax.swing.text.EditorKit extended by javax.swing.text.DefaultEditorKit extended by 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
static 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.
abstract 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 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

          Creates a new EditorKit used for styled documents.
 
Method Summary
 Object

          Creates a copy of the editor kit.
 Document

          Creates an uninitialized text storage model that is appropriate for this type of editor.
protected void

          Copies the key/values in elements AttributeSet into set.
 void

          Called when the kit is being removed from the JEditorPane.
 Action[]

          Fetches the command list for the editor.
 Element

          Fetches the element representing the current run of character attributes for the caret.
 MutableAttributeSet

          Gets the input attributes for the pane.
 ViewFactory

          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 inherited from class javax.swing.text.DefaultEditorKit
createCaret, createDefaultDocument, getActions, getContentType, getViewFactory, read, read, write, write
 
Methods inherited from class javax.swing.text.EditorKit
clone, createCaret, createDefaultDocument, deinstall, getActions, getContentType, getViewFactory, install, read, read, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyledEditorKit

public StyledEditorKit()
Creates a new EditorKit used for styled documents.

Method Detail

clone

public Object clone()
Creates a copy of the editor kit.

Overrides:
clone in class EditorKit
Returns:
the copy

createDefaultDocument

public Document createDefaultDocument()
Creates an uninitialized text storage model that is appropriate for this type of editor.

Overrides:
createDefaultDocument in class DefaultEditorKit
Returns:
the model

createInputAttributes

protected void createInputAttributes(Element element,
                                     MutableAttributeSet set)
Copies the key/values in elements AttributeSet into set. 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 in set.

This is called anytime the caret moves over a different location.

Parameters:
element
set

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.

Overrides:
deinstall in class EditorKit
Parameters:
c - the JEditorPane

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 class DefaultEditorKit
Returns:
the command list

getCharacterAttributeRun

public Element getCharacterAttributeRun()
Fetches the element representing the current run of character attributes for the caret.

Returns:
the element

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.

Overrides:
getInputAttributes in class DefaultEditorKit
Returns:
the attribute set

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:

Overrides:
getViewFactory in class DefaultEditorKit
Returns:
the factory

install

public void install(JEditorPane c)
Called when the kit is being installed into a JEditorPane.

Overrides:
install in class EditorKit
Parameters:
c - the JEditorPane


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.