public class HTMLEditorKit extends StyledEditorKit implements Accessible
有几个目标editorkit提供HTML,HTML,在建模方式的影响。这些都影响了它的设计在一个实质性的方式。
HTML的造型是由类HTMLDocument
提供。它的文档描述了如何HTML模型。编辑支持充分利用了文本包的关闭功能。
HTMLFactory
类提供。这可以很容易地通过继承或更换htmlfactory和重载返回:视图工厂方法返回的替代工厂。JEditorPane.setPage
。这是通过对文件的属性控制。该方法可以被重写为改变这
createDefaultDocument
。工作的
HTMLDocument.HTMLReader
类做配料。实际的工作是由文本中的包和类
DefaultStyledDocument
AbstractDocument
做。
这是由StyleSheet
类提供支持。HTML的表现可以在editorkit样式表中的属性值的影响很大。
Modifier and Type | Class and Description |
---|---|
static class |
HTMLEditorKit.HTMLFactory
工厂建立视图的HTML。
|
static class |
HTMLEditorKit.HTMLTextAction
一个抽象的行动提供一些方便的方法,可以插入HTML到现有的文件是有用的。
|
static class |
HTMLEditorKit.InsertHTMLTextAction
inserthtmltextaction可以插入HTML任意字符串到一个现有的HTML文档。
|
static class |
HTMLEditorKit.LinkController
在适当时,要监视相关组件和消防超链接事件。
|
static class |
HTMLEditorKit.Parser
由解析器支持的接口。
|
static class |
HTMLEditorKit.ParserCallback
解析的结果驱动这些回调方法。
|
StyledEditorKit.AlignmentAction, StyledEditorKit.BoldAction, StyledEditorKit.FontFamilyAction, StyledEditorKit.FontSizeAction, StyledEditorKit.ForegroundAction, StyledEditorKit.ItalicAction, StyledEditorKit.StyledTextAction, StyledEditorKit.UnderlineAction
DefaultEditorKit.BeepAction, DefaultEditorKit.CopyAction, DefaultEditorKit.CutAction, DefaultEditorKit.DefaultKeyTypedAction, DefaultEditorKit.InsertBreakAction, DefaultEditorKit.InsertContentAction, DefaultEditorKit.InsertTabAction, DefaultEditorKit.PasteAction
Modifier and Type | Field and Description |
---|---|
static String |
BOLD_ACTION
大胆动作标识符
|
static String |
COLOR_ACTION
颜色选择动作标识符的颜色作为一个参数传递
|
static String |
DEFAULT_CSS
设置标记视图的默认级联样式表文件。
|
static String |
FONT_CHANGE_BIGGER
字体大小增加到下一个值动作标识符
|
static String |
FONT_CHANGE_SMALLER
字体大小减少到下一个值动作标识符
|
static String |
IMG_ALIGN_BOTTOM
在底部对齐图像。
|
static String |
IMG_ALIGN_MIDDLE
对齐图像在中间。
|
static String |
IMG_ALIGN_TOP
在顶部对齐图像。
|
static String |
IMG_BORDER
对齐边界上的图像。
|
static String |
ITALIC_ACTION
斜体动作标识符
|
static String |
LOGICAL_STYLE_ACTION
逻辑样式选择动作标识符,逻辑样式作为一个参数传递
|
static String |
PARA_INDENT_LEFT
段落左缩进动作标识符
|
static String |
PARA_INDENT_RIGHT
段落的右缩进动作标识符
|
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 and Description |
---|
HTMLEditorKit()
构建了一个创建一个stylecontext HTMLEditorKit执行,,并加载样式表。
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
创建编辑器组件的副本。
|
Document |
createDefaultDocument()
创建一个未初始化的文本存储模式,这种类型的编辑器是合适的。
|
protected void |
createInputAttributes(Element element, MutableAttributeSet set)
副本
element s attributeset键/值为
set 。
|
void |
deinstall(JEditorPane c)
当包被从jeditorpane删除。
|
AccessibleContext |
getAccessibleContext()
返回与此相关的accessiblecontext编辑工具
|
Action[] |
getActions()
获取编辑命令列表。
|
String |
getContentType()
得到这盒代表支持数据的MIME类型。
|
Cursor |
getDefaultCursor()
返回默认光标。
|
MutableAttributeSet |
getInputAttributes()
获取用于样式编辑操作的输入属性。
|
Cursor |
getLinkCursor()
返回使用超链接的光标。
|
protected HTMLEditorKit.Parser |
getParser()
取解析器使用阅读HTML流。
|
StyleSheet |
getStyleSheet()
获得方式目前被用来渲染的HTML元素的集合。
|
ViewFactory |
getViewFactory()
取一个适合于生产任何型号的视图的工厂生产的这个套件。
|
void |
insertHTML(HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag insertTag)
插入HTML到一个已经存在的文件。
|
void |
install(JEditorPane c)
当包被安装到一个jeditorpane。
|
boolean |
isAutoFormSubmission()
指示是否一个HTML表单提交的自动处理或只
FormSubmitEvent 开火。
|
void |
read(Reader in, Document doc, int pos)
从给定流中插入内容。
|
void |
setAutoFormSubmission(boolean isAuto)
指定HTML表单提交的自动处理或只
FormSubmitEvent 开火。
|
void |
setDefaultCursor(Cursor cursor)
设置默认光标。
|
void |
setLinkCursor(Cursor cursor)
设置光标在链接上使用。
|
void |
setStyleSheet(StyleSheet s)
设置样式来呈现不同的HTML元素的集合。
|
void |
write(Writer out, Document doc, int pos, int len)
用适当的格式将文档中的内容写入该类内容处理程序的格式中的内容。
|
getCharacterAttributeRun
createCaret, read, write
public static final String DEFAULT_CSS
public static final String BOLD_ACTION
public static final String ITALIC_ACTION
public static final String PARA_INDENT_LEFT
public static final String PARA_INDENT_RIGHT
public static final String FONT_CHANGE_BIGGER
public static final String FONT_CHANGE_SMALLER
public static final String COLOR_ACTION
public static final String LOGICAL_STYLE_ACTION
public static final String IMG_ALIGN_TOP
public static final String IMG_ALIGN_MIDDLE
public static final String IMG_ALIGN_BOTTOM
public static final String IMG_BORDER
public HTMLEditorKit()
public String getContentType()
text/html
。
getContentType
方法重写,继承类
DefaultEditorKit
public ViewFactory getViewFactory()
getViewFactory
方法重写,继承类
StyledEditorKit
public Document createDefaultDocument()
createDefaultDocument
方法重写,继承类
StyledEditorKit
public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException
doc
是HTML文档的一个实例,这将读取HTML文本的3.2。插入HTML到一个非空的文件必须在体元,如果你不插入体将抛出一个异常。当插入到一个非空的文档中的所有标签以外的身体(头,标题)将被删除。
read
方法重写,继承类
DefaultEditorKit
in
流--读
doc
-插入目的地
pos
-在文档中的位置处的内容
IOException
-任何I/O错误
BadLocationException
如果POS代表文档中的一个无效的位置
RuntimeException
-(最终会是一个badlocationexception)如果POS是无效的
public void insertHTML(HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag insertTag) throws BadLocationException, IOException
doc
-文档插入
offset
-偏移插入HTML
popDepth
- elementspec.endtagtypes数产生之前插入
pushDepth
具有方向elementspec.joinnextdirection应生成之前插入elementspec.starttagtypes数量,但结束后的标签已生成
insertTag
开始插入文档的第一个标签
RuntimeException
-(最终会是一个badlocationexception)如果POS是无效的
BadLocationException
IOException
public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException
write
方法重写,继承类
DefaultEditorKit
out
流-写
doc
为写源
pos
-在文档中的位置获取内容
len
量-写出来
IOException
-任何I/O错误
BadLocationException
如果POS代表文档中的一个无效的位置
public void install(JEditorPane c)
install
方法重写,继承类
StyledEditorKit
c
- JEditorPane
public void deinstall(JEditorPane c)
deinstall
方法重写,继承类
StyledEditorKit
c
- JEditorPane
public void setStyleSheet(StyleSheet s)
public StyleSheet getStyleSheet()
public Action[] getActions()
getActions
方法重写,继承类
StyledEditorKit
protected void createInputAttributes(Element element, MutableAttributeSet set)
element
s attributeset键/值为
set
。这不复制组件、图标或元素名称属性。子类可能希望细化哪些是什么,哪些不是复制在这里。但一定要先删除所有的属性,在
set
。
这就是所谓的随时插入移动到不同的位置。
createInputAttributes
方法重写,继承类
StyledEditorKit
public MutableAttributeSet getInputAttributes()
getInputAttributes
方法重写,继承类
StyledEditorKit
public void setDefaultCursor(Cursor cursor)
public Cursor getDefaultCursor()
public void setLinkCursor(Cursor cursor)
public Cursor getLinkCursor()
public boolean isAutoFormSubmission()
FormSubmitEvent
开火。
setAutoFormSubmission(boolean)
public void setAutoFormSubmission(boolean isAuto)
FormSubmitEvent
开火。默认情况下,它设置为。
isAutoFormSubmission()
,
FormSubmitEvent
public Object clone()
clone
方法重写,继承类
StyledEditorKit
Cloneable
protected HTMLEditorKit.Parser getParser()
public AccessibleContext getAccessibleContext()
getAccessibleContext
接口
Accessible
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.