API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.text. StyleContext View Source
Author(s)
Timothy Prinzing
Since
Version
1.82 04/07/06
Serial
Hierarchy
 Object
      StyleContext
Implements
 Serializable
 AbstractDocument.AttributeContext
Subclasses
Description
public class StyleContext
  A pool of styles and their associated resources.
See also:   
Constructors
public StyleContext ()
Creates a new StyleContext object.
Methods
Hide/Show inherited methods
publicsynchronized AttributeSet addAttribute (AttributeSet old, Object name, Object value) [Specified in AbstractDocument.AttributeContext]
  Adds an attribute to the given set, and returns the new representative set.
publicsynchronized AttributeSet addAttributes (AttributeSet old, AttributeSet attr) [Specified in AbstractDocument.AttributeContext]
  Adds a set of attributes to the element.
public void addChangeListener (ChangeListener l)
  Adds a listener to track when styles are added or removed.
public Style addStyle (String nm, Style parent)
  Adds a new style into the style hierarchy.
protected MutableAttributeSet createLargeAttributeSet (AttributeSet a)
  Create a large set of attributes that should trade off space for time.
protected SmallAttributeSet createSmallAttributeSet (AttributeSet a)
  Create a compact set of attributes that might be shared.
public Color getBackground (AttributeSet attr)
  Takes a set of attributes and turn it into a background color specification.
public ChangeListener getChangeListeners ()
  Returns an array of all the ChangeListeners added to this StyleContext with addChangeListener().
protected int getCompressionThreshold ()
  Returns the maximum number of key/value pairs to try and compress into unique/immutable sets.
publicfinalstatic StyleContext getDefaultStyleContext ()
  Returns default AttributeContext shared by all documents that don't bother to define/supply their own context.
public AttributeSet getEmptySet () [Specified in AbstractDocument.AttributeContext]
  Fetches an empty AttributeSet.
public Font getFont (AttributeSet attr)
  Gets the font from an attribute set.
public Font getFont (String family, int style, int size)
  Gets a new font.
public FontMetrics getFontMetrics (Font f)
  Returns font metrics for a font.
public Color getForeground (AttributeSet attr)
  Takes a set of attributes and turn it into a foreground color specification.
pack-private AttributeSet getImmutableUniqueSet ()
  Search for an existing attribute set using the current search parameters.
pack-private MutableAttributeSet getMutableAttributeSet (AttributeSet a)
Creates a mutable attribute set to hand out because the current needs are too big to try and use a shared version.
publicstatic Object getStaticAttribute (Object key)
Returns the object previously registered with registerStaticAttributeKey.
publicstatic Object getStaticAttributeKey (Object key)
  Returns the String that key will be registered with
public Style getStyle (String nm)
  Fetches a named style previously added to the document
public Enumeration<Object> getStyleNames ()
  Fetches the names of the styles defined.
public void readAttributes (ObjectInputStream in, MutableAttributeSet a) throws ClassNotFoundException IOException
Context-specific handling of reading in attributes
publicstatic void readAttributeSet (ObjectInputStream in, MutableAttributeSet a) throws ClassNotFoundException IOException
  Reads a set of attributes from the given object input stream that have been previously written out with writeAttributeSet.
public void reclaim (AttributeSet a) [Specified in AbstractDocument.AttributeContext]
  Returns a set no longer needed by the MutableAttributeSet implmentation.
publicstatic void registerStaticAttributeKey (Object key)
  Registers an object as a static object that is being used as a key in attribute sets.
publicsynchronized AttributeSet removeAttribute (AttributeSet old, Object name) [Specified in AbstractDocument.AttributeContext]
  Removes an attribute from the set.
publicsynchronized AttributeSet removeAttributes (AttributeSet old, AttributeSet attrs) [Specified in AbstractDocument.AttributeContext]
  Removes a set of attributes for the element.
publicsynchronized AttributeSet removeAttributes (AttributeSet old, Enumeration<Object> names) [Specified in AbstractDocument.AttributeContext]
  Removes a set of attributes for the element.
public void removeChangeListener (ChangeListener l)
  Removes a listener that was tracking styles being added or removed.
public void removeStyle (String nm)
  Removes a named style previously added to the document.
pack-privatesynchronized void removeUnusedSets ()
Clean the unused immutable sets out of the hashtable.
public String toString ()
  Converts a StyleContext to a String.
public void writeAttributes (ObjectOutputStream out, AttributeSet a) throws IOException
Context-specific handling of writing out attributes
publicstatic void writeAttributeSet (ObjectOutputStream out, AttributeSet a) throws IOException
  Writes a set of attributes to the given object stream for the purpose of serialization.
Fields
Hide/Show inherited fields
publicfinalstatic String DEFAULT_STYLE = "default"
The name given to the default logical style attached to paragraphs.
pack-privatefinalstatic int THRESHOLD = "9"
The threshold for no longer sharing the set of attributes in an immutable table.
Nested Classes
  StyleContext.SmallAttributeSet
This class holds a small number of attributes in an array.
  StyleContext.KeyEnumeration
An enumeration of the keys in a SmallAttributeSet.
  StyleContext.KeyBuilder
Sorts the key strings so that they can be very quickly compared in the attribute set searchs.
  StyleContext.FontKey
key for a font table
  StyleContext.NamedStyle
A collection of attributes, typically used to represent character and paragraph styles.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar