|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.swing.text.StyleContext.NamedStyle
public class StyleContext.NamedStyle
通常用于表示字符和段落样式的属性集合。这是 MutableAttributeSet(在需要时可以观察它)的一个实现。当集合足够小时这些样式将利用不可变性的优势,并且可能比诸如 SimpleAttributeSet 之类更为高效。
警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder。
| 嵌套类摘要 |
|---|
| 从接口 javax.swing.text.AttributeSet 继承的嵌套类/接口 |
|---|
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute |
| 字段摘要 | |
|---|---|
protected ChangeEvent |
changeEvent
由于事件的惟一状态(只读)为源属性,因此每个模型实例只需要一个 ChangeEvent。 |
protected EventListenerList |
listenerList
模型的更改侦听器。 |
| 从接口 javax.swing.text.AttributeSet 继承的字段 |
|---|
NameAttribute, ResolveAttribute |
| 构造方法摘要 | |
|---|---|
StyleContext.NamedStyle()
利用 null 名称和父级创建新的命名样式。 |
|
StyleContext.NamedStyle(String name,
Style parent)
创建新的命名样式。 |
|
StyleContext.NamedStyle(Style parent)
创建新的命名样式。 |
|
| 方法摘要 | ||
|---|---|---|
void |
addAttribute(Object name,
Object value)
添加属性。 |
|
void |
addAttributes(AttributeSet attr)
将属性集添加到元素。 |
|
void |
addChangeListener(ChangeListener l)
添加更改侦听器。 |
|
boolean |
containsAttribute(Object name,
Object value)
确定给定的属性名称/值是否已定义。 |
|
boolean |
containsAttributes(AttributeSet attrs)
检查元素是否包含了所有属性。 |
|
AttributeSet |
copyAttributes()
复制属性集。 |
|
protected void |
fireStateChanged()
通知所有对此事件类型的通知感兴趣的已注册侦听器。 |
|
Object |
getAttribute(Object attrName)
获取属性的值。 |
|
int |
getAttributeCount()
返回定义的属性数。 |
|
Enumeration<?> |
getAttributeNames()
获取所有属性的名称。 |
|
ChangeListener[] |
getChangeListeners()
返回使用 addChangeListener() 添加到此 NamedStyle 中的所有 ChangeListener 组成的数组。 |
|
|
getListeners(Class<T> listenerType)
返回具有添加到此模型中的给定类型的所有侦听器组成的数组。 |
|
String |
getName()
获取样式的名称。 |
|
AttributeSet |
getResolveParent()
从父级获取属性。 |
|
boolean |
isDefined(Object attrName)
确定给定属性是否已定义。 |
|
boolean |
isEqual(AttributeSet attr)
检查两个属性集是否相等。 |
|
void |
removeAttribute(Object name)
从集合中移除属性。 |
|
void |
removeAttributes(AttributeSet attrs)
移除元素的属性集。 |
|
void |
removeAttributes(Enumeration<?> names)
移除元素的属性集。 |
|
void |
removeChangeListener(ChangeListener l)
移除更改侦听器。 |
|
void |
setName(String name)
更改样式的名称。 |
|
void |
setResolveParent(AttributeSet parent)
设置解析的父级。 |
|
String |
toString()
将样式转换成为字符串。 |
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
protected EventListenerList listenerList
protected transient ChangeEvent changeEvent
| 构造方法详细信息 |
|---|
public StyleContext.NamedStyle(String name,
Style parent)
name - 样式名称,未命名则为 nullparent - 父样式,如果没有则为 nullpublic StyleContext.NamedStyle(Style parent)
parent - 父样式,如果没有则为 nullpublic StyleContext.NamedStyle()
| 方法详细信息 |
|---|
public String toString()
Object 中的 toStringpublic String getName()
Style 中的 getNamepublic void setName(String name)
name - 新名称public void addChangeListener(ChangeListener l)
Style 中的 addChangeListenerl - 更改侦听器public void removeChangeListener(ChangeListener l)
Style 中的 removeChangeListenerl - 更改侦听器public ChangeListener[] getChangeListeners()
ChangeListener 组成的数组。
ChangeListener,或者在没有添加侦听器时返回空数组protected void fireStateChanged()
EventListenerListpublic <T extends EventListener> T[] getListeners(Class<T> listenerType)
public int getAttributeCount()
AttributeSet 中的 getAttributeCountAttributeSet.getAttributeCount()public boolean isDefined(Object attrName)
AttributeSet 中的 isDefinedattrName - 非空的属性名
AttributeSet.isDefined(java.lang.Object)public boolean isEqual(AttributeSet attr)
AttributeSet 中的 isEqualattr - 要检查的属性集
AttributeSet.isEqual(javax.swing.text.AttributeSet)public AttributeSet copyAttributes()
AttributeSet 中的 copyAttributesAttributeSet.copyAttributes()public Object getAttribute(Object attrName)
AttributeSet 中的 getAttributeattrName - 非空属性名
AttributeSet.getAttribute(java.lang.Object)public Enumeration<?> getAttributeNames()
AttributeSet 中的 getAttributeNamesAttributeSet.getAttributeNames()
public boolean containsAttribute(Object name,
Object value)
AttributeSet 中的 containsAttributename - 非空属性名value - 属性值
AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)public boolean containsAttributes(AttributeSet attrs)
AttributeSet 中的 containsAttributesattrs - 要检查的属性
AttributeSet.containsAttributes(javax.swing.text.AttributeSet)public AttributeSet getResolveParent()
AttributeSet 中的 getResolveParentAttributeSet.getResolveParent()
public void addAttribute(Object name,
Object value)
MutableAttributeSet 中的 addAttributename - 非空属性名value - 属性值MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)public void addAttributes(AttributeSet attr)
MutableAttributeSet 中的 addAttributesattr - 要添加的属性MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)public void removeAttribute(Object name)
MutableAttributeSet 中的 removeAttributename - 非空属性名MutableAttributeSet.removeAttribute(java.lang.Object)public void removeAttributes(Enumeration<?> names)
MutableAttributeSet 中的 removeAttributesnames - 属性名称MutableAttributeSet.removeAttributes(java.util.Enumeration>)public void removeAttributes(AttributeSet attrs)
MutableAttributeSet 中的 removeAttributesattrs - 属性MutableAttributeSet.removeAttributes(java.util.Enumeration>)public void setResolveParent(AttributeSet parent)
MutableAttributeSet 中的 setResolveParentparent - 父级,如果没有则为 nullMutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet)
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only。