| 
 | JavaTM 2 Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.swing.text.EditorKit
public abstract class EditorKit
针对某些类型 的文本内容,建立能够合理发挥编辑器功能的文本组件所需的实现集合。EditorKit 充当某个策略类型的工厂。例如,可以提供 html 和 rtf 的实现,它可与其他实现互换。
工具包可安全存储编辑状态,因为工具包的实例专供文本组件使用。新的工具包通常通过复制原型工具包创建。工具包会调用其 setComponent 方法来建立与 JTextComponent 的联系。
| 构造方法摘要 | |
|---|---|
| EditorKit()构造一个 EditorKit。 | |
| 方法摘要 | |
|---|---|
|  Object | clone()创建此编辑器工具包的副本。 | 
| abstract  Caret | createCaret()获取能在由关联的 ViewFactory 生成的视图中导航的插入符。 | 
| abstract  Document | createDefaultDocument()创建一个适合此编辑器类型的未初始化的文本存储模型。 | 
|  void | deinstall(JEditorPane c)从 JEditorPane 中移除工具包时调用。 | 
| abstract  Action[] | getActions()获取能在文本组件上使用的一组命令,该文本组件使用由此工具包生成的模型和视图。 | 
| abstract  String | getContentType()获得此工具包声明支持的数据的 MIME 类型。 | 
| abstract  ViewFactory | getViewFactory()获取适合生成此工具包生成的任何模型视图的工厂。 | 
|  void | install(JEditorPane c)将工具包安装到 JEditorPane 中时调用。 | 
| abstract  void | read(InputStream in,
     Document doc,
     int pos)插入来自给定流的内容,其格式需要适合此类型的内容处理程序。 | 
| abstract  void | read(Reader in,
     Document doc,
     int pos)插入来自给定流的内容,其格式需要适合此类型的内容处理程序。 | 
| abstract  void | write(OutputStream out,
      Document doc,
      int pos,
      int len)将文档中的内容以适合此类型内容处理程序的格式写入给定的流。 | 
| abstract  void | write(Writer out,
      Document doc,
      int pos,
      int len)将文档中的内容以适合此类型内容处理程序的格式写入给定的流。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 构造方法详细信息 | 
|---|
public EditorKit()
| 方法详细信息 | 
|---|
public Object clone()
Object 中的 cloneCloneablepublic void install(JEditorPane c)
c - JEditorPanepublic void deinstall(JEditorPane c)
c - JEditorPanepublic abstract String getContentType()
public abstract ViewFactory getViewFactory()
public abstract Action[] getActions()
public abstract Caret createCaret()
public abstract Document createDefaultDocument()
public abstract void read(InputStream in,
                          Document doc,
                          int pos)
                   throws IOException,
                          BadLocationException
in - 要读入的流doc - 插入到的目标文档。pos - 文档中放入内容的位置,该值 >= 0。
IOException - 如果有任何 I/O 错误
BadLocationException - 如果 pos 代表文档中的无效位置。
public abstract void write(OutputStream out,
                           Document doc,
                           int pos,
                           int len)
                    throws IOException,
                           BadLocationException
out - 要写入的流doc - 写入所用的源文档。pos - 文档中获取内容的位置,该值 >= 0。len - 要写入的量,该值 >= 0。
IOException - 如果有任何 I/O 错误
BadLocationException - 如果 pos 代表文档中的无效位置。
public abstract void read(Reader in,
                          Document doc,
                          int pos)
                   throws IOException,
                          BadLocationException
由于实际的编辑是基于 unicode 的,这将是读入数据的首选方法。但是有些类型的内容以 8 位形式存储,因此又适合 InputStream。
in - 要读入的流doc - 插入到的目标文档。pos - 文档中放入内容的位置,该值 >= 0。
IOException - 如果有任何 I/O 错误
BadLocationException - 如果 pos 代表文档中的无效位置。
public abstract void write(Writer out,
                           Document doc,
                           int pos,
                           int len)
                    throws IOException,
                           BadLocationException
由于实际的编辑是基于 unicode 的,这将是写入数据的首选方法。但是有些类型的内容以 8 位形式存储,因此又适合 OutputStream。
out - 要写入的流doc - 写入所用的源文档。pos - 文档中获取内容的位置,该值 >= 0。len - 要写出的量,该值 >= 0。
IOException - 如果有任何 I/O 错误
BadLocationException - 如果 pos 代表文档中的无效位置。| 
 | JavaTM 2 Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only。