JavaTM 2 Platform
Standard Ed. 6

javax.swing.text
类 StyledEditorKit.StyledTextAction

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
正在封闭类:
StyledEditorKit

public abstract static class StyledEditorKit.StyledTextAction
extends TextAction

假定是在安装有 StyledEditorKit(或者子类)的 JEditorPane 上触发的操作。此操作具有一些便捷的方法,能导致字符或段落级的属性更改。如果假定 StyledDocument、JEditorPane 或 StyledEditorKit 失败为 true,则此便捷方法将抛出一个 IllegalArgumentException。

如果 ActionEvent 的源可缩小为一个 JEditorPane 类型,则事件在其上执行的组件将成为 ActionEvent 的源。如果该源不能缩小,则更改最近获得焦点的文本组件。如果不是以上两种情况,则不能执行该操作。

警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder


字段摘要
 
从类 javax.swing.AbstractAction 继承的字段
changeSupport, enabled
 
从接口 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
 
构造方法摘要
StyledEditorKit.StyledTextAction(String nm)
          通过字符串操作名称创建新的 StyledTextAction。
 
方法摘要
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)
          对段落应用给定的属性。
 
从类 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
 

构造方法详细信息

StyledEditorKit.StyledTextAction

public StyledEditorKit.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,则首先替换现有的属性

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only