|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.StyleContext.NamedStyle
public class StyleContext.NamedStyle
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface javax.swing.text.AttributeSet |
---|
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute |
Field Summary | |
---|---|
protected ChangeEvent |
changeEvent
|
protected EventListenerList |
listenerList
|
Fields inherited from interface javax.swing.text.AttributeSet |
---|
NameAttribute, ResolveAttribute |
Constructor Summary | |
---|---|
StyleContext.NamedStyle()
|
|
StyleContext.NamedStyle(String name,
Style parent)
|
|
StyleContext.NamedStyle(Style parent)
|
Method Summary | ||
---|---|---|
void |
addAttribute(Object name,
Object value)
Adds an attribute with the given name and value
to the set. |
|
void |
addAttributes(AttributeSet attr)
Adds all the attributes from attributes to this set. |
|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener object to the style. |
|
boolean |
containsAttribute(Object name,
Object value)
Returns true if this AttributeSet contains
an attribute with the specified name and value ,
false otherwise. |
|
boolean |
containsAttributes(AttributeSet attrs)
Returns true of this AttributeSet contains all
of the specified attributes . |
|
AttributeSet |
copyAttributes()
Creates and returns a copy of this AttributeSet . |
|
protected void |
fireStateChanged()
|
|
Object |
getAttribute(Object attrName)
Returns the attribute with the specified key or
null if no such attribute is defined in this
AttributeSet and its resolving parents. |
|
int |
getAttributeCount()
Returns the number of attributes that are stored locally in this AttributeSet . |
|
Enumeration<?> |
getAttributeNames()
Returns the names of the attributes that are stored in this AttributeSet . |
|
ChangeListener[] |
getChangeListeners()
|
|
|
getListeners(Class<T> listenerType)
|
|
String |
getName()
Returns the name of the style. |
|
AttributeSet |
getResolveParent()
Returns the resolving parent of this AttributeSet . |
|
boolean |
isDefined(Object attrName)
Returns true if an attribute with the specified name is
defined locally in this AttributeSet , without resolving
through the resolving parents. |
|
boolean |
isEqual(AttributeSet attr)
Returns true if all of the attributes in attr
are equal to the attributes in this AttributeSet ,
false otherwise. |
|
void |
removeAttribute(Object name)
Removes the attribute with the specified name , if this
attribute is defined. |
|
void |
removeAttributes(AttributeSet attrs)
Removes attributes from this set if they are found in the given set. |
|
void |
removeAttributes(Enumeration<?> names)
Removes the attributes listed in names . |
|
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from to the style. |
|
void |
setName(String n)
|
|
void |
setResolveParent(AttributeSet parent)
Sets the reolving parent for this set. |
|
String |
toString()
Convert this Object to a human-readable String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient ChangeEvent changeEvent
protected EventListenerList listenerList
Constructor Detail |
---|
public StyleContext.NamedStyle()
public StyleContext.NamedStyle(Style parent)
public StyleContext.NamedStyle(String name, Style parent)
Method Detail |
---|
public String getName()
Style
getName
in interface Style
public void setName(String n)
public void addChangeListener(ChangeListener l)
Style
ChangeListener
object to the style.
addChangeListener
in interface Style
l
- the listener object to addpublic void removeChangeListener(ChangeListener l)
Style
ChangeListener
from to the style.
removeChangeListener
in interface Style
l
- the listener object to remove,public <T extends EventListener> T[] getListeners(Class<T> listenerType)
public ChangeListener[] getChangeListeners()
protected void fireStateChanged()
public void addAttribute(Object name, Object value)
MutableAttributeSet
name
and value
to the set. If the set already contains an attribute with the given
name
, the attribute value is updated.
addAttribute
in interface MutableAttributeSet
name
- the attribute name (null
not permitted).value
- the value (null
not permitted).public void addAttributes(AttributeSet attr)
MutableAttributeSet
attributes
to this set.
addAttributes
in interface MutableAttributeSet
attr
- the set of attributes to add (null
not
permitted).public boolean containsAttribute(Object name, Object value)
AttributeSet
true
if this AttributeSet
contains
an attribute with the specified name
and value
,
false
otherwise.
containsAttribute
in interface AttributeSet
name
- the name of the requested attributevalue
- the value of the requested attribute
true
if this AttributeSet
contains
an attribute with the specified name
and
value
, false
otherwisepublic boolean containsAttributes(AttributeSet attrs)
AttributeSet
true
of this AttributeSet
contains all
of the specified attributes
.
containsAttributes
in interface AttributeSet
attrs
- the requested attributes
true
of this AttributeSet
contains all
of the specified attributes
public AttributeSet copyAttributes()
AttributeSet
AttributeSet
.
copyAttributes
in interface AttributeSet
AttributeSet
public Object getAttribute(Object attrName)
AttributeSet
key
or
null
if no such attribute is defined in this
AttributeSet
and its resolving parents.
getAttribute
in interface AttributeSet
attrName
- the key of the attribute that is looked up
key
or
null
if no such attribute is defined in this
AttributeSet
and its resolving parentspublic int getAttributeCount()
AttributeSet
AttributeSet
.
getAttributeCount
in interface AttributeSet
AttributeSet
public Enumeration<?> getAttributeNames()
AttributeSet
AttributeSet
.
getAttributeNames
in interface AttributeSet
AttributeSet
public boolean isDefined(Object attrName)
AttributeSet
true
if an attribute with the specified name is
defined locally in this AttributeSet
, without resolving
through the resolving parents.
isDefined
in interface AttributeSet
true
if an attribute with the specified name is
defined locally in this AttributeSet
public boolean isEqual(AttributeSet attr)
AttributeSet
true
if all of the attributes in attr
are equal to the attributes in this AttributeSet
,
false
otherwise.
isEqual
in interface AttributeSet
attr
- the attributes to be compared to this
true
if all of the attributes in attr
are equal to the attributes in this AttributeSet
,
false
otherwisepublic void removeAttribute(Object name)
MutableAttributeSet
name
, if this
attribute is defined. This method will only remove an attribute from
this set, not from the resolving parent.
removeAttribute
in interface MutableAttributeSet
name
- the attribute name (null
not permitted).public void removeAttributes(AttributeSet attrs)
MutableAttributeSet
attributes
has the same resolving parent as this set, the
parent will be removed from this set.
removeAttributes
in interface MutableAttributeSet
attrs
- the attributes (null
not permitted).public void removeAttributes(Enumeration<?> names)
MutableAttributeSet
names
.
removeAttributes
in interface MutableAttributeSet
names
- the attribute names (null
not permitted).public AttributeSet getResolveParent()
AttributeSet
AttributeSet
.
If a key is not stored locally, then a AttributeSet.getAttribute(Object)
request is resolved up in the resolving parent of this
AttributeSet
.
getResolveParent
in interface AttributeSet
AttributeSet
public void setResolveParent(AttributeSet parent)
MutableAttributeSet
setResolveParent
in interface MutableAttributeSet
parent
- the parent attribute set (null
not permitted).public String toString()
Object
System.out.println()
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a RuntimeException
.
This method will be called when performing string
concatenation with this object. If the result is
null
, string concatenation will instead
use "null"
.
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode())
.
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |