public abstract static class StyledEditorKit.StyledTextAction extends TextAction
如果源可以缩小为JEditorPane类型,则动作所采取行动的组件将成为ActionEvent的源。 如果源无法缩小,则最近重点关注的文本组件将被更改。 如果这些都不是这种情况,则无法执行该操作。
警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对所有JavaBeans的长期存储的支持已被添加到java.beans
包中。 请参阅XMLEncoder
。
changeSupport, enabled
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 and Description |
---|
StyledTextAction(String nm)
从字符串操作名称创建一个新的StyledTextAction。
|
Modifier and Type | Method and Description |
---|---|
protected JEditorPane |
getEditor(ActionEvent e)
获取操作的目标编辑器。
|
protected StyledDocument |
getStyledDocument(JEditorPane e)
获取与编辑器窗格关联的文档。
|
protected StyledEditorKit |
getStyledEditorKit(JEditorPane e)
获取与编辑器窗格相关联的编辑工具包。
|
protected void |
setCharacterAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
将给定的属性应用于字符内容。
|
protected void |
setParagraphAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
将给定的属性应用于段落。
|
augmentList, getFocusedComponent, getTextComponent
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
actionPerformed
public StyledTextAction(String nm)
nm
- 动作的名称
protected final JEditorPane getEditor(ActionEvent e)
e
- 动作事件
protected final StyledDocument getStyledDocument(JEditorPane e)
e
- 编辑
IllegalArgumentException
- 对于错误的文档类型
protected final StyledEditorKit getStyledEditorKit(JEditorPane e)
e
- 编辑器窗格
IllegalArgumentException
- 对于错误的文档类型
protected final void setCharacterAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
editor
- 编辑
attr
- 属性
replace
- 如果为true,则先替换现有属性
protected final void setParagraphAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
editor
- 编辑
attr
- 属性
replace
- if true, replace the existing attributes first
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.