javax.swing.text
public class StyleContext extends Object implements Serializable, AbstractDocument.AttributeContext
| Nested Class Summary | |
|---|---|
| class | StyleContext.NamedStyle |
| class | StyleContext.SmallAttributeSet |
| Field Summary | |
|---|---|
| static String | DEFAULT_STYLE
The name of the default style. |
| Constructor Summary | |
|---|---|
| StyleContext()
Creates a new instance of the style context. | |
| Method Summary | |
|---|---|
| AttributeSet | addAttribute(AttributeSet old, Object name, Object value) |
| AttributeSet | addAttributes(AttributeSet old, AttributeSet attributes) |
| void | addChangeListener(ChangeListener listener) |
| Style | addStyle(String name, Style parent) |
| protected MutableAttributeSet | createLargeAttributeSet(AttributeSet a) |
| protected StyleContext.SmallAttributeSet | createSmallAttributeSet(AttributeSet a) |
| Color | getBackground(AttributeSet a) |
| ChangeListener[] | getChangeListeners() |
| protected int | getCompressionThreshold() |
| static StyleContext | getDefaultStyleContext() |
| AttributeSet | getEmptySet() |
| Font | getFont(AttributeSet attr) |
| Font | getFont(String family, int style, int size) |
| FontMetrics | getFontMetrics(Font f) |
| Color | getForeground(AttributeSet a) |
| static Object | getStaticAttribute(Object key)
Gets the object previously registered with registerStaticAttributeKey.
|
| static Object | getStaticAttributeKey(Object key)
Returns the String that key will be registered with
registerStaticAttributeKey.
|
| Style | getStyle(String name)
Get the style from the style table. |
| Enumeration<?> | getStyleNames()
Get the names of the style. |
| void | readAttributes(ObjectInputStream in, MutableAttributeSet a)
Handles reading in the attributes. |
| static void | readAttributeSet(ObjectInputStream in, MutableAttributeSet a)
Reads a set of attributes from the given object input stream. |
| void | reclaim(AttributeSet attributes) |
| static void | registerStaticAttributeKey(Object key)
Registers an attribute key as a well-known keys. |
| AttributeSet | removeAttribute(AttributeSet old, Object name) |
| AttributeSet | removeAttributes(AttributeSet old, AttributeSet attributes) |
| AttributeSet | removeAttributes(AttributeSet old, Enumeration<?> names) |
| void | removeChangeListener(ChangeListener listener) |
| void | removeStyle(String name) |
| String | toString()
Returns a string representation of this StyleContext.
|
| void | writeAttributes(ObjectOutputStream out, AttributeSet a)
Handles writing of the given attributes. |
| static void | writeAttributeSet(ObjectOutputStream out, AttributeSet a)
Serialize an attribute set in a way that is compatible with it
being read in again by StyleContext.
|
Parameters: key - the key that was registered.
Returns: the object previously registered with registerStaticAttributeKey.
Parameters: key - the key that will be registered.
Returns: the string the key will be registered with.
null if the style with the given name is not defined.
Parameters: name the name of the style.
Returns: the style with the given name or null if no such defined.
Parameters: in - the stream to read from a - the set of attributes
Throws: ClassNotFoundException - may be encountered when reading from stream IOException - any I/O error
Parameters: in - the stream to read from a - the set of attributes
Throws: ClassNotFoundException - may be encountered when reading from stream IOException - any I/O error
StyleContext are registered as static keys. If you define
additional attribute keys that you want to exist as nonreplicated objects,
then you should register them using this method.
Parameters: key the key to register as static attribute key
Returns: a string representation of this StyleContext
Parameters: out - stream to write to a - the attribute set
Throws: IOException - any I/O error
Parameters: out - stream to write to a - the attribute set
Throws: IOException - any I/O error