Home » openjdk-7 » javax » swing » text » [javadoc | source]
javax.swing.text
abstract public class: EditorKit [javadoc | source]
java.lang.Object
   javax.swing.text.EditorKit

All Implemented Interfaces:
    Cloneable, Serializable

Direct Known Subclasses:
    MyHTMLEditorKit, DefaultEditorKit, StyledEditorKit, PlainEditorKit, PlainEditorKit, RTFEditorKit, BasicEditorKit, HTMLEditorKit

Establishes the set of things needed by a text component to be a reasonably functioning editor for some type of text content. The EditorKit acts as a factory for some kind of policy. For example, an implementation of html and rtf can be provided that is replaceable with other implementations.

A kit can safely store editing state as an instance of the kit will be dedicated to a text component. New kits will normally be created by cloning a prototype kit. The kit will have it's setComponent method called to establish it's relationship with a JTextComponent.

Constructor:
 public EditorKit() 
Method from javax.swing.text.EditorKit Summary:
clone,   createCaret,   createDefaultDocument,   deinstall,   getActions,   getContentType,   getViewFactory,   install,   read,   read,   write,   write
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.EditorKit Detail:
 public Object clone() 
    Creates a copy of the editor kit. This is implemented to use Object.clone. If the kit cannot be cloned, null is returned.
 abstract public Caret createCaret()
    Fetches a caret that can navigate through views produced by the associated ViewFactory.
 abstract public Document createDefaultDocument()
    Creates an uninitialized text storage model that is appropriate for this type of editor.
 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.
 abstract 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.
 abstract public String getContentType()
    Gets the MIME type of the data that this kit represents support for.
 abstract public ViewFactory getViewFactory()
    Fetches a factory that is suitable for producing views of any models that are produced by this kit.
 public  void install(JEditorPane c) 
    Called when the kit is being installed into the a JEditorPane.
 abstract 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.
 abstract public  void read(Reader 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.

    Since actual text editing is unicode based, this would generally be the preferred way to read in the data. Some types of content are stored in an 8-bit form however, and will favor the InputStream.

 abstract 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.
 abstract public  void write(Writer 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.

    Since actual text editing is unicode based, this would generally be the preferred way to write the data. Some types of content are stored in an 8-bit form however, and will favor the OutputStream.