- java.lang.Object
-
- javax.swing.AbstractAction
-
- javax.swing.text.TextAction
-
- javax.swing.text.StyledEditorKit.StyledTextAction
-
- 实现的所有接口
-
ActionListener,Serializable,Cloneable,EventListener,Action
- 已知直接子类:
-
HTMLEditorKit.HTMLTextAction,StyledEditorKit.AlignmentAction,StyledEditorKit.BoldAction,StyledEditorKit.FontFamilyAction,StyledEditorKit.FontSizeAction,StyledEditorKit.ForegroundAction,StyledEditorKit.ItalicAction,StyledEditorKit.UnderlineAction
- Enclosing class:
- StyledEditorKit
public abstract static class StyledEditorKit.StyledTextAction extends TextAction
假定它在安装了StyledEditorKit(或子类)的JEditorPane上被触发的动作。 这有一些方便的方法可以导致字符或段落级属性更改。 如果StyledDocument,JEditorPane或StyledEditorKit的假设不成立,则方便方法将抛出IllegalArgumentException。如果源可以缩小为JEditorPane类型,则由该操作执行操作的组件将成为ActionEvent的源。 如果无法缩小源,则更改最近聚焦的文本组件。 如果这两种情况都不是,则无法执行操作。
警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,对
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。- 另请参见:
- Serialized Form
-
-
字段汇总
-
声明的属性在类 javax.swing.AbstractAction
changeSupport, enabled
-
Fields 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
-
-
构造方法摘要
构造方法 构造器 描述 StyledTextAction(String nm)从字符串操作名称创建新的StyledTextAction。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 protected JEditorPanegetEditor(ActionEvent e)获取操作的目标编辑器。protected StyledDocumentgetStyledDocument(JEditorPane e)获取与编辑器窗格关联的文档。protected StyledEditorKitgetStyledEditorKit(JEditorPane e)获取与编辑器窗格关联的编辑器工具包。protected voidsetCharacterAttributes(JEditorPane editor, AttributeSet attr, boolean replace)将给定属性应用于角色内容。protected voidsetParagraphAttributes(JEditorPane editor, AttributeSet attr, boolean replace)将给定属性应用于段落。-
声明方法的类 javax.swing.text.TextAction
augmentList, getFocusedComponent, getTextComponent
-
声明方法的类 javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
声明方法的类 java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
声明方法的接口 java.awt.event.ActionListener
actionPerformed
-
-
-
-
构造方法详细信息
-
StyledTextAction
public StyledTextAction(String nm)
从字符串操作名称创建新的StyledTextAction。- 参数
-
nm- 操作的名称
-
-
方法详细信息
-
getEditor
protected final JEditorPane getEditor(ActionEvent e)
获取操作的目标编辑器。- 参数
-
e- 动作事件 - 结果
- 编辑
-
getStyledDocument
protected final StyledDocument getStyledDocument(JEditorPane e)
获取与编辑器窗格关联的文档。- 参数
-
e- 编辑 - 结果
- 该文件
- 异常
-
IllegalArgumentException- 用于错误的文档类型
-
getStyledEditorKit
protected final StyledEditorKit getStyledEditorKit(JEditorPane e)
获取与编辑器窗格关联的编辑器工具包。- 参数
-
e- 编辑器窗格 - 结果
- 套件
- 异常
-
IllegalArgumentException- 对于错误的文档类型
-
setCharacterAttributes
protected final void setCharacterAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
将给定属性应用于角色内容。 如果有选择,则属性将应用于选择范围。 如果没有选择,则将属性应用于输入属性集,该属性集定义要插入的任何新文本的属性。- 参数
-
editor- 编辑 -
attr- 属性 -
replace- 如果为true,则首先替换现有属性
-
setParagraphAttributes
protected final void setParagraphAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
将给定属性应用于段落。 如果存在选择,则属性将应用于与选择相交的段落。 如果没有选择,则属性将应用于当前插入符号位置的段落。- 参数
-
editor- 编辑 -
attr- 属性 -
replace- 如果为true,replace替换现有属性
-
-