java.lang.Object
javax.swing.AbstractAction
javax.swing.text.TextAction
javax.swing.text.StyledEditorKit.StyledTextAction
javax.swing.text.html.HTMLEditorKit.HTMLTextAction
- 所有已实现的接口:
-
ActionListener,Serializable,Cloneable,EventListener,Action
- 直接已知的子类:
-
HTMLEditorKit.InsertHTMLTextAction
- 封装类:
-
HTMLEditorKit
一个抽象的Action,提供一些方便的方法,可用于将HTML插入到现有文档中。
注意: 所有方便的方法都不会锁定文档。如果您有另一个线程修改文本,这些方法可能会表现不一致,或者返回错误的内容。
-
Field Summary
Fields declared in class javax.swing.AbstractAction
changeSupport, enabledFields declared in interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intelementCountToTag(HTMLDocument doc, int offset, HTML.Tag tag) 返回元素数量,从最深的叶子开始,直到找到表示tag的元素为止。protected ElementfindElementMatchingTag(HTMLDocument doc, int offset, HTML.Tag tag) 返回匹配tag的offset处的最深元素。protected Element[]getElementsAt(HTMLDocument doc, int offset) 返回包含offset的元素数组。protected HTMLDocument返回给定JEditorPane的HTMLDocument。protected HTMLEditorKit返回给定JEditorPane的HTMLEditorKit。Methods declared in class javax.swing.text.StyledEditorKit.StyledTextAction
getEditor, getStyledDocument, getStyledEditorKit, setCharacterAttributes, setParagraphAttributesMethods declared in class javax.swing.text.TextAction
augmentList, getFocusedComponent, getTextComponentMethods declared in class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledMethods declared in class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface java.awt.event.ActionListener
actionPerformed
-
Constructor Details
-
HTMLTextAction
从字符串动作名称创建一个新的HTMLTextAction。- 参数:
-
name- 动作的名称
-
-
Method Details
-
getHTMLDocument
返回给定JEditorPane的HTMLDocument。- 参数:
-
e- JEditorPane - 返回:
-
e的HTMLDocument。
-
getHTMLEditorKit
返回给定JEditorPane的HTMLEditorKit。- 参数:
-
e- JEditorPane - 返回:
-
e的HTMLEditorKit。
-
getElementsAt
返回包含offset的元素数组。第一个元素对应根元素。- 参数:
-
doc- HTMLDocument的一个实例 -
offset- 偏移值 - 返回:
-
包含
offset的元素数组
-
elementCountToTag
返回元素数量,从最深的叶子开始,直到找到表示tag的元素为止。如果找不到表示tag的元素,则返回-1;如果位于offset处的叶子的父级表示tag,则返回0。- 参数:
-
doc- HTMLDocument的一个实例 -
offset- 起始偏移量 -
tag- 要表示的标签 - 返回:
- 元素数量
-
findElementMatchingTag
返回匹配tag的offset处的最深元素。- 参数:
-
doc- HTMLDocument的一个实例 -
offset- 指定的偏移量 >= 0 -
tag- HTML.Tag的一个实例 - 返回:
- 最深的元素
-