public class StyleContext.NamedStyle extends Object implements Style, Serializable
 警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对所有JavaBeans的长期存储的支持已经添加到java.beans包中。 请参阅XMLEncoder 。 
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute| Modifier and Type | Field and Description | 
|---|---|
| protected ChangeEvent | changeEvent
              由于事件的唯一(只读)状态是源属性,因此每个模型实例只需要一个ChangeEvent。 
             | 
| protected EventListenerList | listenerList
              模型的变化监听器。 
             | 
NameAttribute, ResolveAttribute| Constructor and Description | 
|---|
| NamedStyle()
              创建一个新的命名样式,具有null名称和父项。 
             | 
| NamedStyle(String name, Style parent)
              创建一个新的命名样式。 
             | 
| NamedStyle(Style parent)
              创建一个新的命名样式。 
             | 
| Modifier and Type | Method and Description | 
|---|---|
| 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的数组。 | 
| <T extends EventListener> | getListeners(类<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()
              将样式转换为字符串。 
             | 
protected EventListenerList listenerList
protected transient ChangeEvent changeEvent
public NamedStyle(String name, Style parent)
name - 样式名称,未命名为null 
           parent - 父样式,如果没有则为null 
           public NamedStyle(Style parent)
parent - 父样式,如果没有则为null 
           public NamedStyle()
public String getName()
public void setName(String name)
name - 新名字 
           public void addChangeListener(ChangeListener l)
addChangeListener在接口 
            Style 
           l - 变更听众 
           public void removeChangeListener(ChangeListener l)
removeChangeListener在界面 
            Style 
           l - 变更听众 
           public ChangeListener[] getChangeListeners()
ChangeListener的数组。 
          ChangeListener如果没有添加侦听器,则为空数组 
           protected void fireStateChanged()
EventListenerList 
           public <T extends EventListener> T[] getListeners(类<T> listenerType)
public int getAttributeCount()
getAttributeCount在接口 
            AttributeSet 
           AttributeSet.getAttributeCount() 
           public boolean isDefined(Object attrName)
isDefined在界面 
            AttributeSet 
           attrName - 非空属性名称 
           AttributeSet.isDefined(java.lang.Object) 
           public boolean isEqual(AttributeSet attr)
isEqual在接口 
            AttributeSet 
           attr - 要检查的属性设置 
           AttributeSet.isEqual(javax.swing.text.AttributeSet) 
           public AttributeSet copyAttributes()
copyAttributes在界面 
            AttributeSet 
           AttributeSet.copyAttributes() 
           public Object getAttribute(Object attrName)
getAttribute在界面 
            AttributeSet 
           attrName - 非空属性名称 
           AttributeSet.getAttribute(java.lang.Object) 
           public Enumeration<?> getAttributeNames()
getAttributeNames在接口 
            AttributeSet 
           AttributeSet.getAttributeNames() 
           public boolean containsAttribute(Object name, Object value)
containsAttribute在接口 
            AttributeSet 
           name - 非空属性名称 
           value - 属性值 
           AttributeSet.containsAttribute(java.lang.Object, java.lang.Object) 
           public boolean containsAttributes(AttributeSet attrs)
containsAttributes在接口 
            AttributeSet 
           attrs - 要检查的属性 
           AttributeSet.containsAttributes(javax.swing.text.AttributeSet) 
           public AttributeSet getResolveParent()
getResolveParent在界面 
            AttributeSet 
           AttributeSet.getResolveParent() 
           public void addAttribute(Object name, Object value)
addAttribute在接口 
            MutableAttributeSet 
           name - 非空属性名称 
           value - 属性值 
           MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object) 
           public void addAttributes(AttributeSet attr)
addAttributes在界面 
            MutableAttributeSet 
           attr - 要添加的属性 
           MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object) 
           public void removeAttribute(Object name)
removeAttribute在界面 
            MutableAttributeSet 
           name - 非空属性名称 
           MutableAttributeSet.removeAttribute(java.lang.Object) 
           public void removeAttributes(Enumeration<?> names)
removeAttributes中的 
            MutableAttributeSet 
           names - 属性名称 
           MutableAttributeSet.removeAttributes(java.util.Enumeration<?>) 
           public void removeAttributes(AttributeSet attrs)
removeAttributes在界面 
            MutableAttributeSet 
           attrs - 属性 
           MutableAttributeSet.removeAttributes(java.util.Enumeration<?>) 
           public void setResolveParent(AttributeSet parent)
setResolveParent在接口 
            MutableAttributeSet 
           parent - 父,如果没有,为null 
           MutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet) 
            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.