javax.swing.text
Class EditorKit

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.text.EditorKit
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable
Direct Known Subclasses:
DefaultEditorKit sample code for javax.swing.text.DefaultEditorKit definition code for javax.swing.text.DefaultEditorKit

public abstract class EditorKit
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

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.

See Also:
Serialized Form

Constructor Summary
EditorKit sample code for javax.swing.text.EditorKit.EditorKit() definition code for javax.swing.text.EditorKit.EditorKit() ()
          Construct an EditorKit.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for javax.swing.text.EditorKit.clone() definition code for javax.swing.text.EditorKit.clone() ()
          Creates a copy of the editor kit.
abstract  Caret sample code for javax.swing.text.Caret definition code for javax.swing.text.Caret createCaret sample code for javax.swing.text.EditorKit.createCaret() definition code for javax.swing.text.EditorKit.createCaret() ()
          Fetches a caret that can navigate through views produced by the associated ViewFactory.
abstract  Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document createDefaultDocument sample code for javax.swing.text.EditorKit.createDefaultDocument() definition code for javax.swing.text.EditorKit.createDefaultDocument() ()
          Creates an uninitialized text storage model that is appropriate for this type of editor.
 void deinstall sample code for javax.swing.text.EditorKit.deinstall(javax.swing.JEditorPane) definition code for javax.swing.text.EditorKit.deinstall(javax.swing.JEditorPane) (JEditorPane sample code for javax.swing.JEditorPane definition code for javax.swing.JEditorPane  c)
          Called when the kit is being removed from the JEditorPane.
abstract  Action sample code for javax.swing.Action definition code for javax.swing.Action [] getActions sample code for javax.swing.text.EditorKit.getActions() definition code for javax.swing.text.EditorKit.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  String sample code for java.lang.String definition code for java.lang.String getContentType sample code for javax.swing.text.EditorKit.getContentType() definition code for javax.swing.text.EditorKit.getContentType() ()
          Gets the MIME type of the data that this kit represents support for.
abstract  ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory getViewFactory sample code for javax.swing.text.EditorKit.getViewFactory() definition code for javax.swing.text.EditorKit.getViewFactory() ()
          Fetches a factory that is suitable for producing views of any models that are produced by this kit.
 void install sample code for javax.swing.text.EditorKit.install(javax.swing.JEditorPane) definition code for javax.swing.text.EditorKit.install(javax.swing.JEditorPane) (JEditorPane sample code for javax.swing.JEditorPane definition code for javax.swing.JEditorPane  c)
          Called when the kit is being installed into the a JEditorPane.
abstract  void read sample code for javax.swing.text.EditorKit.read(java.io.InputStream, javax.swing.text.Document, int) definition code for javax.swing.text.EditorKit.read(java.io.InputStream, javax.swing.text.Document, int) (InputStream sample code for java.io.InputStream definition code for java.io.InputStream  in, Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc, int pos)
          Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
abstract  void read sample code for javax.swing.text.EditorKit.read(java.io.Reader, javax.swing.text.Document, int) definition code for javax.swing.text.EditorKit.read(java.io.Reader, javax.swing.text.Document, int) (Reader sample code for java.io.Reader definition code for java.io.Reader  in, Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc, int pos)
          Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
abstract  void write sample code for javax.swing.text.EditorKit.write(java.io.OutputStream, javax.swing.text.Document, int, int) definition code for javax.swing.text.EditorKit.write(java.io.OutputStream, javax.swing.text.Document, int, int) (OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out, Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc, int pos, int len)
          Writes content from a document to the given stream in a format appropriate for this kind of content handler.
abstract  void write sample code for javax.swing.text.EditorKit.write(java.io.Writer, javax.swing.text.Document, int, int) definition code for javax.swing.text.EditorKit.write(java.io.Writer, javax.swing.text.Document, int, int) (Writer sample code for java.io.Writer definition code for java.io.Writer  out, Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc, int pos, int len)
          Writes content from a document to the given stream in a format appropriate for this kind of content handler.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

EditorKit sample code for javax.swing.text.EditorKit() definition code for javax.swing.text.EditorKit()

public EditorKit()
Construct an EditorKit.

Method Detail

clone sample code for javax.swing.text.EditorKit.clone() definition code for javax.swing.text.EditorKit.clone()

public Object sample code for java.lang.Object definition code for java.lang.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.

Overrides:
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the copy
See Also:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

install sample code for javax.swing.text.EditorKit.install(javax.swing.JEditorPane) definition code for javax.swing.text.EditorKit.install(javax.swing.JEditorPane)

public void install(JEditorPane sample code for javax.swing.JEditorPane definition code for javax.swing.JEditorPane  c)
Called when the kit is being installed into the a JEditorPane.

Parameters:
c - the JEditorPane

deinstall sample code for javax.swing.text.EditorKit.deinstall(javax.swing.JEditorPane) definition code for javax.swing.text.EditorKit.deinstall(javax.swing.JEditorPane)

public void deinstall(JEditorPane sample code for javax.swing.JEditorPane definition code for javax.swing.JEditorPane  c)
Called when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached.

Parameters:
c - the JEditorPane

getContentType sample code for javax.swing.text.EditorKit.getContentType() definition code for javax.swing.text.EditorKit.getContentType()

public abstract String sample code for java.lang.String definition code for java.lang.String  getContentType()
Gets the MIME type of the data that this kit represents support for.

Returns:
the type

getViewFactory sample code for javax.swing.text.EditorKit.getViewFactory() definition code for javax.swing.text.EditorKit.getViewFactory()

public abstract ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  getViewFactory()
Fetches a factory that is suitable for producing views of any models that are produced by this kit.

Returns:
the factory

getActions sample code for javax.swing.text.EditorKit.getActions() definition code for javax.swing.text.EditorKit.getActions()

public abstract Action sample code for javax.swing.Action definition code for javax.swing.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.

Returns:
the set of actions

createCaret sample code for javax.swing.text.EditorKit.createCaret() definition code for javax.swing.text.EditorKit.createCaret()

public abstract Caret sample code for javax.swing.text.Caret definition code for javax.swing.text.Caret  createCaret()
Fetches a caret that can navigate through views produced by the associated ViewFactory.

Returns:
the caret

createDefaultDocument sample code for javax.swing.text.EditorKit.createDefaultDocument() definition code for javax.swing.text.EditorKit.createDefaultDocument()

public abstract Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  createDefaultDocument()
Creates an uninitialized text storage model that is appropriate for this type of editor.

Returns:
the model

read sample code for javax.swing.text.EditorKit.read(java.io.InputStream, javax.swing.text.Document, int) definition code for javax.swing.text.EditorKit.read(java.io.InputStream, javax.swing.text.Document, int)

public abstract void read(InputStream sample code for java.io.InputStream definition code for java.io.InputStream  in,
                          Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc,
                          int pos)
                   throws IOException sample code for java.io.IOException definition code for java.io.IOException ,
                          BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException 
Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.

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 sample code for java.io.IOException definition code for java.io.IOException - on any I/O error
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if pos represents an invalid location within the document.

write sample code for javax.swing.text.EditorKit.write(java.io.OutputStream, javax.swing.text.Document, int, int) definition code for javax.swing.text.EditorKit.write(java.io.OutputStream, javax.swing.text.Document, int, int)

public abstract void write(OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  out,
                           Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc,
                           int pos,
                           int len)
                    throws IOException sample code for java.io.IOException definition code for java.io.IOException ,
                           BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException 
Writes content from a document to the given stream in a format appropriate for this kind of content handler.

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 sample code for java.io.IOException definition code for java.io.IOException - on any I/O error
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if pos represents an invalid location within the document.

read sample code for javax.swing.text.EditorKit.read(java.io.Reader, javax.swing.text.Document, int) definition code for javax.swing.text.EditorKit.read(java.io.Reader, javax.swing.text.Document, int)

public abstract void read(Reader sample code for java.io.Reader definition code for java.io.Reader  in,
                          Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc,
                          int pos)
                   throws IOException sample code for java.io.IOException definition code for java.io.IOException ,
                          BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.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.

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 sample code for java.io.IOException definition code for java.io.IOException - on any I/O error
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if pos represents an invalid location within the document.

write sample code for javax.swing.text.EditorKit.write(java.io.Writer, javax.swing.text.Document, int, int) definition code for javax.swing.text.EditorKit.write(java.io.Writer, javax.swing.text.Document, int, int)

public abstract void write(Writer sample code for java.io.Writer definition code for java.io.Writer  out,
                           Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document  doc,
                           int pos,
                           int len)
                    throws IOException sample code for java.io.IOException definition code for java.io.IOException ,
                           BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.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.

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 sample code for java.io.IOException definition code for java.io.IOException - on any I/O error
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if pos represents an invalid location within the document.