- java.lang.Object
-
- javax.swing.text.SimpleAttributeSet
-
- 实现的所有接口
-
Serializable,Cloneable,AttributeSet,MutableAttributeSet
public class SimpleAttributeSet extends Object implements MutableAttributeSet, Serializable, Cloneable
使用哈希表直接实现MutableAttributeSet。警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。- 另请参见:
- Serialized Form
-
-
嵌套类汇总
-
Nested classes/interfaces declared in interface javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
-
-
字段汇总
字段 变量和类型 字段 描述 static AttributeSetEMPTY空属性集。-
Fields declared in interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute
-
-
构造方法摘要
构造方法 构造器 描述 SimpleAttributeSet()创建一个新的属性集。SimpleAttributeSet(AttributeSet source)根据提供的属性集创建新的属性集。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voidaddAttribute(Object name, Object value)向列表添加属性。voidaddAttributes(AttributeSet attributes)向列表添加一组属性。Objectclone()克隆一组属性。booleancontainsAttribute(Object name, Object value)检查属性列表是否包含指定的属性名称/值对。booleancontainsAttributes(AttributeSet attributes)检查属性列表是否包含所有指定的名称/值对。AttributeSetcopyAttributes()制作属性的副本。booleanequals(Object obj)将此对象与指定的对象进行比较。ObjectgetAttribute(Object name)获取属性的值。intgetAttributeCount()获取属性数的计数。Enumeration<?>getAttributeNames()获取集合中属性的名称。AttributeSetgetResolveParent()获取解析父级。inthashCode()返回此属性集的哈希码。booleanisDefined(Object attrName)判断是否定义了给定属性。booleanisEmpty()检查属性集是否为空。booleanisEqual(AttributeSet attr)比较两个属性集。voidremoveAttribute(Object name)从列表中删除属性。voidremoveAttributes(Enumeration<?> names)从列表中删除一组属性。voidremoveAttributes(AttributeSet attributes)从列表中删除一组属性。voidsetResolveParent(AttributeSet parent)设置解析父级。StringtoString()将属性集转换为String。
-
-
-
字段详细信息
-
EMPTY
public static final AttributeSet EMPTY
空属性集。
-
-
构造方法详细信息
-
SimpleAttributeSet
public SimpleAttributeSet()
创建一个新的属性集。
-
SimpleAttributeSet
public SimpleAttributeSet(AttributeSet source)
根据提供的属性集创建新的属性集。- 参数
-
source- 属性集
-
-
方法详细信息
-
isEmpty
public boolean isEmpty()
检查属性集是否为空。- 结果
- 如果集合为空,则返回true,否则返回false
-
getAttributeCount
public int getAttributeCount()
获取属性数的计数。- Specified by:
-
getAttributeCount在界面AttributeSet - 结果
- 伯爵
-
isDefined
public boolean isDefined(Object attrName)
判断是否定义了给定属性。- Specified by:
-
isDefined在界面AttributeSet - 参数
-
attrName- 属性名称 - 结果
- 如果定义了属性,则为true
-
isEqual
public boolean isEqual(AttributeSet attr)
比较两个属性集。- Specified by:
-
isEqual在界面AttributeSet - 参数
-
attr- 第二个属性集 - 结果
- 如果集合相等则为true,否则为false
-
copyAttributes
public AttributeSet copyAttributes()
制作属性的副本。- Specified by:
-
copyAttributes在界面AttributeSet - 结果
- 副本
-
getAttributeNames
public Enumeration<?> getAttributeNames()
获取集合中属性的名称。- Specified by:
-
getAttributeNames在界面AttributeSet - 结果
-
这些名字是
Enumeration
-
getAttribute
public Object getAttribute(Object name)
获取属性的值。- Specified by:
-
getAttribute在界面AttributeSet - 参数
-
name- 属性名称 - 结果
- 价值
-
containsAttribute
public boolean containsAttribute(Object name, Object value)
检查属性列表是否包含指定的属性名称/值对。- Specified by:
-
containsAttribute在界面AttributeSet - 参数
-
name- 名称 -
value- 该值 - 结果
- 如果名称/值对在列表中,则为true
-
containsAttributes
public boolean containsAttributes(AttributeSet attributes)
检查属性列表是否包含所有指定的名称/值对。- Specified by:
-
containsAttributes在界面AttributeSet - 参数
-
attributes- 属性列表 - 结果
- 如果列表包含所有名称/值对,则为true
-
addAttribute
public void addAttribute(Object name, Object value)
向列表添加属性。- Specified by:
-
addAttribute在界面MutableAttributeSet - 参数
-
name- 属性名称 -
value- 属性值
-
addAttributes
public void addAttributes(AttributeSet attributes)
向列表添加一组属性。- Specified by:
-
addAttributes在界面MutableAttributeSet - 参数
-
attributes- 要添加的属性集
-
removeAttribute
public void removeAttribute(Object name)
从列表中删除属性。- Specified by:
-
removeAttribute在界面MutableAttributeSet - 参数
-
name- 属性名称
-
removeAttributes
public void removeAttributes(Enumeration<?> names)
从列表中删除一组属性。- Specified by:
-
removeAttributes在界面MutableAttributeSet - 参数
-
names- 要删除的名称集
-
removeAttributes
public void removeAttributes(AttributeSet attributes)
从列表中删除一组属性。- Specified by:
-
removeAttributes在界面MutableAttributeSet - 参数
-
attributes- 要删除的属性集
-
getResolveParent
public AttributeSet getResolveParent()
获取解析父级。 如果未在本地定义属性,则这是要解析的属性集。 如果没有其他要解析的属性集,则为null。- Specified by:
-
getResolveParent在界面AttributeSet - 结果
- 父母
-
setResolveParent
public void setResolveParent(AttributeSet parent)
设置解析父级。- Specified by:
-
setResolveParent在界面MutableAttributeSet - 参数
-
parent- 父母
-
hashCode
public int hashCode()
返回此属性集的哈希码。- 重写:
-
hashCode在课堂Object - 结果
- 这组属性的哈希码值。
- 另请参见:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object obj)
将此对象与指定的对象进行比较。 如果对象是一组等效的属性,则结果为true。- 重写:
-
equals在类Object - 参数
-
obj- 要与此属性集进行比较的对象 - 结果
-
true如果对象相等; 否则为false - 另请参见:
-
Object.hashCode(),HashMap
-
-