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版本开始,已将所有JavaBeans的长期存储支持添加到java.beans包中。请参阅XMLEncoder。
-
Nested Class Summary
Nested classes/interfaces declared in interface javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute -
Field Summary
FieldsFields declared in interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(Object name, Object value) 将属性添加到列表中。voidaddAttributes(AttributeSet attributes) 将一组属性添加到列表中。clone()克隆一组属性。booleancontainsAttribute(Object name, Object value) 检查属性列表是否包含指定的属性名/值对。booleancontainsAttributes(AttributeSet attributes) 检查属性列表是否包含所有指定的名称/值对。复制属性。boolean将此对象与指定对象进行比较。getAttribute(Object name) 获取属性的值。int获取属性的数量。Enumeration<?> 获取集合中属性的名称。获取解析父级。inthashCode()返回此属性集的哈希码。boolean判断给定属性是否已定义。booleanisEmpty()检查属性集是否为空。booleanisEqual(AttributeSet attr) 比较两个属性集。voidremoveAttribute(Object name) 从列表中移除属性。voidremoveAttributes(Enumeration<?> names) 从列表中移除一组属性。voidremoveAttributes(AttributeSet attributes) 从列表中移除一组属性。voidsetResolveParent(AttributeSet parent) 设置解析父级。toString()将属性集转换为字符串。
-
Field Details
-
EMPTY
一个空的属性集。
-
-
Constructor Details
-
SimpleAttributeSet
public SimpleAttributeSet()创建一个新的属性集。 -
SimpleAttributeSet
基于提供的属性集创建一个新的属性集。- 参数:
-
source- 属性集
-
-
Method Details
-
isEmpty
public boolean isEmpty()检查属性集是否为空。- 返回:
- 如果属性集为空则返回true,否则返回false
-
getAttributeCount
public int getAttributeCount()获取属性的数量。- 指定者:
-
getAttributeCount在接口AttributeSet中 - 返回:
- 数量
-
isDefined
判断给定属性是否已定义。- 指定者:
-
isDefined在接口AttributeSet中 - 参数:
-
attrName- 属性名称 - 返回:
- 如果属性已定义则返回true
-
isEqual
比较两个属性集。- 指定者:
-
isEqual在接口AttributeSet中 - 参数:
-
attr- 第二个属性集 - 返回:
- 如果两个集合相等则返回true,否则返回false
-
copyAttributes
复制属性。- 指定者:
-
copyAttributes在接口AttributeSet中 - 返回:
- 复制品
-
getAttributeNames
获取集合中属性的名称。- 指定者:
-
getAttributeNames在接口AttributeSet中 - 返回:
-
名称作为
Enumeration
-
getAttribute
获取属性的值。- 指定者:
-
getAttribute在接口AttributeSet中 - 参数:
-
name- 属性名称 - 返回:
- 值
-
containsAttribute
检查属性列表是否包含指定的属性名/值对。- 指定者:
-
containsAttribute在接口AttributeSet中 - 参数:
-
name- 名称 -
value- 值 - 返回:
- 如果名称/值对在列表中则返回true
-
containsAttributes
检查属性列表是否包含所有指定的名称/值对。- 指定者:
-
containsAttributes在接口AttributeSet中 - 参数:
-
attributes- 属性列表 - 返回:
- 如果列表包含所有名称/值对则返回true
-
addAttribute
将属性添加到列表中。- 指定者:
-
addAttribute在接口MutableAttributeSet中 - 参数:
-
name- 属性名称 -
value- 属性值
-
addAttributes
将一组属性添加到列表中。- 指定者:
-
addAttributes在接口MutableAttributeSet中 - 参数:
-
attributes- 要添加的属性集
-
removeAttribute
从列表中移除属性。- 指定者:
-
removeAttribute在接口MutableAttributeSet中 - 参数:
-
name- 属性名称
-
removeAttributes
从列表中移除一组属性。- 指定者:
-
removeAttributes在接口MutableAttributeSet中 - 参数:
-
names- 要移除的名称集合
-
removeAttributes
从列表中移除一组属性。- 指定者:
-
removeAttributes在接口MutableAttributeSet中 - 参数:
-
attributes- 要移除的属性集
-
getResolveParent
获取解析父级。如果属性在本地未定义,则通过此属性集解析。如果没有其他属性集可供解析,则为null。- 指定者:
-
getResolveParent在接口AttributeSet中 - 返回:
- 父级
-
setResolveParent
设置解析父级。- 指定者:
-
setResolveParent在接口MutableAttributeSet中 - 参数:
-
parent- 父级
-
clone
克隆一组属性。 -
hashCode
public int hashCode()返回此属性集的哈希码。 -
equals
将此对象与指定对象进行比较。如果对象是等价的属性集,则结果为true。 -
toString
将属性集转换为字符串。
-