javax.swing.text.html
Class StyleSheet

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.text.StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext 
      extended by javax.swing.text.html.StyleSheet
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , AbstractDocument.AttributeContext sample code for javax.swing.text.AbstractDocument.AttributeContext definition code for javax.swing.text.AbstractDocument.AttributeContext

public class StyleSheet
extends StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext

Support for defining the visual characteristics of HTML views being rendered. The StyleSheet is used to translate the HTML model into visual characteristics. This enables views to be customized by a look-and-feel, multiple views over the same model can be rendered differently, etc. This can be thought of as a CSS rule repository. The key for CSS attributes is an object of type CSS.Attribute. The type of the value is up to the StyleSheet implementation, but the toString method is required to return a string representation of CSS value.

The primary entry point for HTML View implementations to get their attributes is the getViewAttributes method. This should be implemented to establish the desired policy used to associate attributes with the view. Each HTMLEditorKit (i.e. and therefore each associated JEditorPane) can have its own StyleSheet, but by default one sheet will be shared by all of the HTMLEditorKit instances. HTMLDocument instance can also have a StyleSheet, which holds the document-specific CSS specifications.

In order for Views to store less state and therefore be more lightweight, the StyleSheet can act as a factory for painters that handle some of the rendering tasks. This allows implementations to determine what they want to cache and have the sharing potentially at the level that a selector is common to multiple views. Since the StyleSheet may be used by views over multiple documents and typically the HTML attributes don't effect the selector being used, the potential for sharing is significant.

The rules are stored as named styles, and other information is stored to translate the context of an element to a rule quickly. The following code fragment will display the named styles, and therefore the CSS rules contained.

   
   import java.util.*;
   import javax.swing.text.*;
   import javax.swing.text.html.*;
   
   public class ShowStyles {
   
       public static void main(String[] args) {
           HTMLEditorKit kit = new HTMLEditorKit();
           HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
           StyleSheet styles = doc.getStyleSheet();
           
           Enumeration rules = styles.getStyleNames();
           while (rules.hasMoreElements()) {
               String name = (String) rules.nextElement();
               Style rule = styles.getStyle(name);
               System.out.println(rule.toString());
           }
           System.exit(0);
       }
   }
   
 

The semantics for when a CSS style should overide visual attributes defined by an element are not well defined. For example, the html <body bgcolor=red> makes the body have a red background. But if the html file also contains the CSS rule body { background: blue } it becomes less clear as to what color the background of the body should be. The current implemention gives visual attributes defined in the element the highest precedence, that is they are always checked before any styles. Therefore, in the previous example the background would have a red color as the body element defines the background color to be red.

As already mentioned this supports CSS. We don't support the full CSS spec. Refer to the javadoc of the CSS class to see what properties we support. The two major CSS parsing related concepts we do not currently support are pseudo selectors, such as A:link { color: red }, and the important modifier.

Note: This implementation is currently incomplete. It can be replaced with alternative implementations that are complete. Future versions of this class will provide better CSS support.

See Also:
Serialized Form

Nested Class Summary
static class StyleSheet.BoxPainter sample code for javax.swing.text.html.StyleSheet.BoxPainter definition code for javax.swing.text.html.StyleSheet.BoxPainter
          Class to carry out some of the duties of CSS formatting.
static class StyleSheet.ListPainter sample code for javax.swing.text.html.StyleSheet.ListPainter definition code for javax.swing.text.html.StyleSheet.ListPainter
          Class to carry out some of the duties of CSS list formatting.
 
Nested classes/interfaces inherited from class javax.swing.text.StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
StyleContext.NamedStyle sample code for javax.swing.text.StyleContext.NamedStyle definition code for javax.swing.text.StyleContext.NamedStyle , StyleContext.SmallAttributeSet sample code for javax.swing.text.StyleContext.SmallAttributeSet definition code for javax.swing.text.StyleContext.SmallAttributeSet
 
Field Summary
 
Fields inherited from class javax.swing.text.StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
DEFAULT_STYLE sample code for javax.swing.text.StyleContext.DEFAULT_STYLE definition code for javax.swing.text.StyleContext.DEFAULT_STYLE
 
Constructor Summary
StyleSheet sample code for javax.swing.text.html.StyleSheet.StyleSheet() definition code for javax.swing.text.html.StyleSheet.StyleSheet() ()
          Construct a StyleSheet
 
Method Summary
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet addAttribute sample code for javax.swing.text.html.StyleSheet.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object) definition code for javax.swing.text.html.StyleSheet.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old, Object sample code for java.lang.Object definition code for java.lang.Object  key, Object sample code for java.lang.Object definition code for java.lang.Object  value)
          Adds an attribute to the given set, and returns the new representative set.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet addAttributes sample code for javax.swing.text.html.StyleSheet.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old, AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  attr)
          Adds a set of attributes to the element.
 void addCSSAttribute sample code for javax.swing.text.html.StyleSheet.addCSSAttribute(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String) definition code for javax.swing.text.html.StyleSheet.addCSSAttribute(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String) (MutableAttributeSet sample code for javax.swing.text.MutableAttributeSet definition code for javax.swing.text.MutableAttributeSet  attr, CSS.Attribute sample code for javax.swing.text.html.CSS.Attribute definition code for javax.swing.text.html.CSS.Attribute  key, String sample code for java.lang.String definition code for java.lang.String  value)
          Adds a CSS attribute to the given set.
 boolean addCSSAttributeFromHTML sample code for javax.swing.text.html.StyleSheet.addCSSAttributeFromHTML(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String) definition code for javax.swing.text.html.StyleSheet.addCSSAttributeFromHTML(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String) (MutableAttributeSet sample code for javax.swing.text.MutableAttributeSet definition code for javax.swing.text.MutableAttributeSet  attr, CSS.Attribute sample code for javax.swing.text.html.CSS.Attribute definition code for javax.swing.text.html.CSS.Attribute  key, String sample code for java.lang.String definition code for java.lang.String  value)
          Adds a CSS attribute to the given set.
 void addRule sample code for javax.swing.text.html.StyleSheet.addRule(java.lang.String) definition code for javax.swing.text.html.StyleSheet.addRule(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  rule)
          Adds a set of rules to the sheet.
 void addStyleSheet sample code for javax.swing.text.html.StyleSheet.addStyleSheet(javax.swing.text.html.StyleSheet) definition code for javax.swing.text.html.StyleSheet.addStyleSheet(javax.swing.text.html.StyleSheet) (StyleSheet sample code for javax.swing.text.html.StyleSheet definition code for javax.swing.text.html.StyleSheet  ss)
          Adds the rules from the StyleSheet ss to those of the receiver.
protected  MutableAttributeSet sample code for javax.swing.text.MutableAttributeSet definition code for javax.swing.text.MutableAttributeSet createLargeAttributeSet sample code for javax.swing.text.html.StyleSheet.createLargeAttributeSet(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.createLargeAttributeSet(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Creates a large set of attributes that should trade off space for time.
protected  StyleContext.SmallAttributeSet sample code for javax.swing.text.StyleContext.SmallAttributeSet definition code for javax.swing.text.StyleContext.SmallAttributeSet createSmallAttributeSet sample code for javax.swing.text.html.StyleSheet.createSmallAttributeSet(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.createSmallAttributeSet(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Creates a compact set of attributes that might be shared.
 Color sample code for java.awt.Color definition code for java.awt.Color getBackground sample code for javax.swing.text.html.StyleSheet.getBackground(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getBackground(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Takes a set of attributes and turn it into a background color specification.
 URL sample code for java.net.URL definition code for java.net.URL getBase sample code for javax.swing.text.html.StyleSheet.getBase() definition code for javax.swing.text.html.StyleSheet.getBase() ()
          Returns the base.
 StyleSheet.BoxPainter sample code for javax.swing.text.html.StyleSheet.BoxPainter definition code for javax.swing.text.html.StyleSheet.BoxPainter getBoxPainter sample code for javax.swing.text.html.StyleSheet.getBoxPainter(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getBoxPainter(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Fetches the box formatter to use for the given set of CSS attributes.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet getDeclaration sample code for javax.swing.text.html.StyleSheet.getDeclaration(java.lang.String) definition code for javax.swing.text.html.StyleSheet.getDeclaration(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  decl)
          Translates a CSS declaration to an AttributeSet that represents the CSS declaration.
 Font sample code for java.awt.Font definition code for java.awt.Font getFont sample code for javax.swing.text.html.StyleSheet.getFont(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getFont(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Fetches the font to use for the given set of attributes.
 Color sample code for java.awt.Color definition code for java.awt.Color getForeground sample code for javax.swing.text.html.StyleSheet.getForeground(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getForeground(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Takes a set of attributes and turn it into a foreground color specification.
static int getIndexOfSize sample code for javax.swing.text.html.StyleSheet.getIndexOfSize(float) definition code for javax.swing.text.html.StyleSheet.getIndexOfSize(float) (float pt)
           
 StyleSheet.ListPainter sample code for javax.swing.text.html.StyleSheet.ListPainter definition code for javax.swing.text.html.StyleSheet.ListPainter getListPainter sample code for javax.swing.text.html.StyleSheet.getListPainter(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getListPainter(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Fetches the list formatter to use for the given set of CSS attributes.
 float getPointSize sample code for javax.swing.text.html.StyleSheet.getPointSize(int) definition code for javax.swing.text.html.StyleSheet.getPointSize(int) (int index)
          Returns the point size, given a size index.
 float getPointSize sample code for javax.swing.text.html.StyleSheet.getPointSize(java.lang.String) definition code for javax.swing.text.html.StyleSheet.getPointSize(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  size)
          Given a string such as "+2", "-2", or "2", returns a point size value.
 Style sample code for javax.swing.text.Style definition code for javax.swing.text.Style getRule sample code for javax.swing.text.html.StyleSheet.getRule(javax.swing.text.html.HTML.Tag, javax.swing.text.Element) definition code for javax.swing.text.html.StyleSheet.getRule(javax.swing.text.html.HTML.Tag, javax.swing.text.Element) (HTML.Tag sample code for javax.swing.text.html.HTML.Tag definition code for javax.swing.text.html.HTML.Tag  t, Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  e)
          Fetches the style to use to render the given type of HTML tag.
 Style sample code for javax.swing.text.Style definition code for javax.swing.text.Style getRule sample code for javax.swing.text.html.StyleSheet.getRule(java.lang.String) definition code for javax.swing.text.html.StyleSheet.getRule(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  selector)
          Fetches the rule that best matches the selector given in string form.
 StyleSheet sample code for javax.swing.text.html.StyleSheet definition code for javax.swing.text.html.StyleSheet [] getStyleSheets sample code for javax.swing.text.html.StyleSheet.getStyleSheets() definition code for javax.swing.text.html.StyleSheet.getStyleSheets() ()
          Returns an array of the linked StyleSheets.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet getViewAttributes sample code for javax.swing.text.html.StyleSheet.getViewAttributes(javax.swing.text.View) definition code for javax.swing.text.html.StyleSheet.getViewAttributes(javax.swing.text.View) (View sample code for javax.swing.text.View definition code for javax.swing.text.View  v)
          Fetches a set of attributes to use in the view for displaying.
 void importStyleSheet sample code for javax.swing.text.html.StyleSheet.importStyleSheet(java.net.URL) definition code for javax.swing.text.html.StyleSheet.importStyleSheet(java.net.URL) (URL sample code for java.net.URL definition code for java.net.URL  url)
          Imports a style sheet from url.
 void loadRules sample code for javax.swing.text.html.StyleSheet.loadRules(java.io.Reader, java.net.URL) definition code for javax.swing.text.html.StyleSheet.loadRules(java.io.Reader, java.net.URL) (Reader sample code for java.io.Reader definition code for java.io.Reader  in, URL sample code for java.net.URL definition code for java.net.URL  ref)
          Loads a set of rules that have been specified in terms of CSS1 grammar.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet removeAttribute sample code for javax.swing.text.html.StyleSheet.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object) definition code for javax.swing.text.html.StyleSheet.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old, Object sample code for java.lang.Object definition code for java.lang.Object  key)
          Removes an attribute from the set.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet removeAttributes sample code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old, AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  attrs)
          Removes a set of attributes.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet removeAttributes sample code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration) definition code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old, Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <?> names)
          Removes a set of attributes for the element.
 void removeStyle sample code for javax.swing.text.html.StyleSheet.removeStyle(java.lang.String) definition code for javax.swing.text.html.StyleSheet.removeStyle(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  nm)
          Removes a named style previously added to the document.
 void removeStyleSheet sample code for javax.swing.text.html.StyleSheet.removeStyleSheet(javax.swing.text.html.StyleSheet) definition code for javax.swing.text.html.StyleSheet.removeStyleSheet(javax.swing.text.html.StyleSheet) (StyleSheet sample code for javax.swing.text.html.StyleSheet definition code for javax.swing.text.html.StyleSheet  ss)
          Removes the StyleSheet ss from those of the receiver.
 void setBase sample code for javax.swing.text.html.StyleSheet.setBase(java.net.URL) definition code for javax.swing.text.html.StyleSheet.setBase(java.net.URL) (URL sample code for java.net.URL definition code for java.net.URL  base)
          Sets the base.
 void setBaseFontSize sample code for javax.swing.text.html.StyleSheet.setBaseFontSize(int) definition code for javax.swing.text.html.StyleSheet.setBaseFontSize(int) (int sz)
          Sets the base font size, with valid values between 1 and 7.
 void setBaseFontSize sample code for javax.swing.text.html.StyleSheet.setBaseFontSize(java.lang.String) definition code for javax.swing.text.html.StyleSheet.setBaseFontSize(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  size)
          Sets the base font size from the passed in String.
 Color sample code for java.awt.Color definition code for java.awt.Color stringToColor sample code for javax.swing.text.html.StyleSheet.stringToColor(java.lang.String) definition code for javax.swing.text.html.StyleSheet.stringToColor(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  string)
          Converts a color string such as "RED" or "#NNNNNN" to a Color.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet translateHTMLToCSS sample code for javax.swing.text.html.StyleSheet.translateHTMLToCSS(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.translateHTMLToCSS(javax.swing.text.AttributeSet) (AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  htmlAttrSet)
          Converts a set of HTML attributes to an equivalent set of CSS attributes.
 
Methods inherited from class javax.swing.text.StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
addChangeListener sample code for javax.swing.text.StyleContext.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.text.StyleContext.addChangeListener(javax.swing.event.ChangeListener) , addStyle sample code for javax.swing.text.StyleContext.addStyle(java.lang.String, javax.swing.text.Style) definition code for javax.swing.text.StyleContext.addStyle(java.lang.String, javax.swing.text.Style) , getChangeListeners sample code for javax.swing.text.StyleContext.getChangeListeners() definition code for javax.swing.text.StyleContext.getChangeListeners() , getCompressionThreshold sample code for javax.swing.text.StyleContext.getCompressionThreshold() definition code for javax.swing.text.StyleContext.getCompressionThreshold() , getDefaultStyleContext sample code for javax.swing.text.StyleContext.getDefaultStyleContext() definition code for javax.swing.text.StyleContext.getDefaultStyleContext() , getEmptySet sample code for javax.swing.text.StyleContext.getEmptySet() definition code for javax.swing.text.StyleContext.getEmptySet() , getFont sample code for javax.swing.text.StyleContext.getFont(java.lang.String, int, int) definition code for javax.swing.text.StyleContext.getFont(java.lang.String, int, int) , getFontMetrics sample code for javax.swing.text.StyleContext.getFontMetrics(java.awt.Font) definition code for javax.swing.text.StyleContext.getFontMetrics(java.awt.Font) , getStaticAttribute sample code for javax.swing.text.StyleContext.getStaticAttribute(java.lang.Object) definition code for javax.swing.text.StyleContext.getStaticAttribute(java.lang.Object) , getStaticAttributeKey sample code for javax.swing.text.StyleContext.getStaticAttributeKey(java.lang.Object) definition code for javax.swing.text.StyleContext.getStaticAttributeKey(java.lang.Object) , getStyle sample code for javax.swing.text.StyleContext.getStyle(java.lang.String) definition code for javax.swing.text.StyleContext.getStyle(java.lang.String) , getStyleNames sample code for javax.swing.text.StyleContext.getStyleNames() definition code for javax.swing.text.StyleContext.getStyleNames() , readAttributes sample code for javax.swing.text.StyleContext.readAttributes(java.io.ObjectInputStream, javax.swing.text.MutableAttributeSet) definition code for javax.swing.text.StyleContext.readAttributes(java.io.ObjectInputStream, javax.swing.text.MutableAttributeSet) , readAttributeSet sample code for javax.swing.text.StyleContext.readAttributeSet(java.io.ObjectInputStream, javax.swing.text.MutableAttributeSet) definition code for javax.swing.text.StyleContext.readAttributeSet(java.io.ObjectInputStream, javax.swing.text.MutableAttributeSet) , reclaim sample code for javax.swing.text.StyleContext.reclaim(javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.reclaim(javax.swing.text.AttributeSet) , registerStaticAttributeKey sample code for javax.swing.text.StyleContext.registerStaticAttributeKey(java.lang.Object) definition code for javax.swing.text.StyleContext.registerStaticAttributeKey(java.lang.Object) , removeChangeListener sample code for javax.swing.text.StyleContext.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.text.StyleContext.removeChangeListener(javax.swing.event.ChangeListener) , toString sample code for javax.swing.text.StyleContext.toString() definition code for javax.swing.text.StyleContext.toString() , writeAttributes sample code for javax.swing.text.StyleContext.writeAttributes(java.io.ObjectOutputStream, javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.writeAttributes(java.io.ObjectOutputStream, javax.swing.text.AttributeSet) , writeAttributeSet sample code for javax.swing.text.StyleContext.writeAttributeSet(java.io.ObjectOutputStream, javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.writeAttributeSet(java.io.ObjectOutputStream, javax.swing.text.AttributeSet)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

StyleSheet sample code for javax.swing.text.html.StyleSheet() definition code for javax.swing.text.html.StyleSheet()

public StyleSheet()
Construct a StyleSheet

Method Detail

getRule sample code for javax.swing.text.html.StyleSheet.getRule(javax.swing.text.html.HTML.Tag, javax.swing.text.Element) definition code for javax.swing.text.html.StyleSheet.getRule(javax.swing.text.html.HTML.Tag, javax.swing.text.Element)

public Style sample code for javax.swing.text.Style definition code for javax.swing.text.Style  getRule(HTML.Tag sample code for javax.swing.text.html.HTML.Tag definition code for javax.swing.text.html.HTML.Tag  t,
                     Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  e)
Fetches the style to use to render the given type of HTML tag. The element given is representing the tag and can be used to determine the nesting for situations where the attributes will differ if nesting inside of elements.

Parameters:
t - the type to translate to visual attributes
e - the element representing the tag; the element can be used to determine the nesting for situations where the attributes will differ if nested inside of other elements
Returns:
the set of CSS attributes to use to render the tag

getRule sample code for javax.swing.text.html.StyleSheet.getRule(java.lang.String) definition code for javax.swing.text.html.StyleSheet.getRule(java.lang.String)

public Style sample code for javax.swing.text.Style definition code for javax.swing.text.Style  getRule(String sample code for java.lang.String definition code for java.lang.String  selector)
Fetches the rule that best matches the selector given in string form. Where selector is a space separated String of the element names. For example, selector might be 'html body tr td''

The attributes of the returned Style will change as rules are added and removed. That is if you to ask for a rule with a selector "table p" and a new rule was added with a selector of "p" the returned Style would include the new attributes from the rule "p".


addRule sample code for javax.swing.text.html.StyleSheet.addRule(java.lang.String) definition code for javax.swing.text.html.StyleSheet.addRule(java.lang.String)

public void addRule(String sample code for java.lang.String definition code for java.lang.String  rule)
Adds a set of rules to the sheet. The rules are expected to be in valid CSS format. Typically this would be called as a result of parsing a <style> tag.


getDeclaration sample code for javax.swing.text.html.StyleSheet.getDeclaration(java.lang.String) definition code for javax.swing.text.html.StyleSheet.getDeclaration(java.lang.String)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  getDeclaration(String sample code for java.lang.String definition code for java.lang.String  decl)
Translates a CSS declaration to an AttributeSet that represents the CSS declaration. Typically this would be called as a result of encountering an HTML style attribute.


loadRules sample code for javax.swing.text.html.StyleSheet.loadRules(java.io.Reader, java.net.URL) definition code for javax.swing.text.html.StyleSheet.loadRules(java.io.Reader, java.net.URL)

public void loadRules(Reader sample code for java.io.Reader definition code for java.io.Reader  in,
                      URL sample code for java.net.URL definition code for java.net.URL  ref)
               throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Loads a set of rules that have been specified in terms of CSS1 grammar. If there are collisions with existing rules, the newly specified rule will win.

Parameters:
in - the stream to read the CSS grammar from
ref - the reference URL. This value represents the location of the stream and may be null. All relative URLs specified in the stream will be based upon this parameter.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException

getViewAttributes sample code for javax.swing.text.html.StyleSheet.getViewAttributes(javax.swing.text.View) definition code for javax.swing.text.html.StyleSheet.getViewAttributes(javax.swing.text.View)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  getViewAttributes(View sample code for javax.swing.text.View definition code for javax.swing.text.View  v)
Fetches a set of attributes to use in the view for displaying. This is basically a set of attributes that can be used for View.getAttributes.


removeStyle sample code for javax.swing.text.html.StyleSheet.removeStyle(java.lang.String) definition code for javax.swing.text.html.StyleSheet.removeStyle(java.lang.String)

public void removeStyle(String sample code for java.lang.String definition code for java.lang.String  nm)
Removes a named style previously added to the document.

Overrides:
removeStyle sample code for javax.swing.text.StyleContext.removeStyle(java.lang.String) definition code for javax.swing.text.StyleContext.removeStyle(java.lang.String) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
nm - the name of the style to remove

addStyleSheet sample code for javax.swing.text.html.StyleSheet.addStyleSheet(javax.swing.text.html.StyleSheet) definition code for javax.swing.text.html.StyleSheet.addStyleSheet(javax.swing.text.html.StyleSheet)

public void addStyleSheet(StyleSheet sample code for javax.swing.text.html.StyleSheet definition code for javax.swing.text.html.StyleSheet  ss)
Adds the rules from the StyleSheet ss to those of the receiver. ss's rules will override the rules of any previously added style sheets. An added StyleSheet will never override the rules of the receiving style sheet.

Since:
1.3

removeStyleSheet sample code for javax.swing.text.html.StyleSheet.removeStyleSheet(javax.swing.text.html.StyleSheet) definition code for javax.swing.text.html.StyleSheet.removeStyleSheet(javax.swing.text.html.StyleSheet)

public void removeStyleSheet(StyleSheet sample code for javax.swing.text.html.StyleSheet definition code for javax.swing.text.html.StyleSheet  ss)
Removes the StyleSheet ss from those of the receiver.

Since:
1.3

getStyleSheets sample code for javax.swing.text.html.StyleSheet.getStyleSheets() definition code for javax.swing.text.html.StyleSheet.getStyleSheets()

public StyleSheet sample code for javax.swing.text.html.StyleSheet definition code for javax.swing.text.html.StyleSheet [] getStyleSheets()
Returns an array of the linked StyleSheets. Will return null if there are no linked StyleSheets.

Since:
1.3

importStyleSheet sample code for javax.swing.text.html.StyleSheet.importStyleSheet(java.net.URL) definition code for javax.swing.text.html.StyleSheet.importStyleSheet(java.net.URL)

public void importStyleSheet(URL sample code for java.net.URL definition code for java.net.URL  url)
Imports a style sheet from url. The resulting rules are directly added to the receiver. If you do not want the rules to become part of the receiver, create a new StyleSheet and use addStyleSheet to link it in.

Since:
1.3

setBase sample code for javax.swing.text.html.StyleSheet.setBase(java.net.URL) definition code for javax.swing.text.html.StyleSheet.setBase(java.net.URL)

public void setBase(URL sample code for java.net.URL definition code for java.net.URL  base)
Sets the base. All import statements that are relative, will be relative to base.

Since:
1.3

getBase sample code for javax.swing.text.html.StyleSheet.getBase() definition code for javax.swing.text.html.StyleSheet.getBase()

public URL sample code for java.net.URL definition code for java.net.URL  getBase()
Returns the base.

Since:
1.3

addCSSAttribute sample code for javax.swing.text.html.StyleSheet.addCSSAttribute(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String) definition code for javax.swing.text.html.StyleSheet.addCSSAttribute(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String)

public void addCSSAttribute(MutableAttributeSet sample code for javax.swing.text.MutableAttributeSet definition code for javax.swing.text.MutableAttributeSet  attr,
                            CSS.Attribute sample code for javax.swing.text.html.CSS.Attribute definition code for javax.swing.text.html.CSS.Attribute  key,
                            String sample code for java.lang.String definition code for java.lang.String  value)
Adds a CSS attribute to the given set.

Since:
1.3

addCSSAttributeFromHTML sample code for javax.swing.text.html.StyleSheet.addCSSAttributeFromHTML(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String) definition code for javax.swing.text.html.StyleSheet.addCSSAttributeFromHTML(javax.swing.text.MutableAttributeSet, javax.swing.text.html.CSS.Attribute, java.lang.String)

public boolean addCSSAttributeFromHTML(MutableAttributeSet sample code for javax.swing.text.MutableAttributeSet definition code for javax.swing.text.MutableAttributeSet  attr,
                                       CSS.Attribute sample code for javax.swing.text.html.CSS.Attribute definition code for javax.swing.text.html.CSS.Attribute  key,
                                       String sample code for java.lang.String definition code for java.lang.String  value)
Adds a CSS attribute to the given set.

Since:
1.3

translateHTMLToCSS sample code for javax.swing.text.html.StyleSheet.translateHTMLToCSS(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.translateHTMLToCSS(javax.swing.text.AttributeSet)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  translateHTMLToCSS(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  htmlAttrSet)
Converts a set of HTML attributes to an equivalent set of CSS attributes.

Parameters:
htmlAttrSet - AttributeSet containing the HTML attributes.

addAttribute sample code for javax.swing.text.html.StyleSheet.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object) definition code for javax.swing.text.html.StyleSheet.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  addAttribute(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old,
                                 Object sample code for java.lang.Object definition code for java.lang.Object  key,
                                 Object sample code for java.lang.Object definition code for java.lang.Object  value)
Adds an attribute to the given set, and returns the new representative set. This is reimplemented to convert StyleConstant attributes to CSS prior to forwarding to the superclass behavior. The StyleConstants attribute has no corresponding CSS entry, the StyleConstants attribute is stored (but will likely be unused).

Specified by:
addAttribute sample code for javax.swing.text.AbstractDocument.AttributeContext.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object) definition code for javax.swing.text.AbstractDocument.AttributeContext.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object) in interface AbstractDocument.AttributeContext sample code for javax.swing.text.AbstractDocument.AttributeContext definition code for javax.swing.text.AbstractDocument.AttributeContext
Overrides:
addAttribute sample code for javax.swing.text.StyleContext.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object) definition code for javax.swing.text.StyleContext.addAttribute(javax.swing.text.AttributeSet, java.lang.Object, java.lang.Object) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
old - the old attribute set
key - the non-null attribute key
value - the attribute value
Returns:
the updated attribute set
See Also:
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object) sample code for javax.swing.text.MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object) definition code for javax.swing.text.MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)

addAttributes sample code for javax.swing.text.html.StyleSheet.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  addAttributes(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old,
                                  AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  attr)
Adds a set of attributes to the element. If any of these attributes are StyleConstants attributes, they will be converted to CSS prior to forwarding to the superclass behavior.

Specified by:
addAttributes sample code for javax.swing.text.AbstractDocument.AttributeContext.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.AttributeContext.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) in interface AbstractDocument.AttributeContext sample code for javax.swing.text.AbstractDocument.AttributeContext definition code for javax.swing.text.AbstractDocument.AttributeContext
Overrides:
addAttributes sample code for javax.swing.text.StyleContext.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.addAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
old - the old attribute set
attr - the attributes to add
Returns:
the updated attribute set
See Also:
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object) sample code for javax.swing.text.MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object) definition code for javax.swing.text.MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)

removeAttribute sample code for javax.swing.text.html.StyleSheet.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object) definition code for javax.swing.text.html.StyleSheet.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  removeAttribute(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old,
                                    Object sample code for java.lang.Object definition code for java.lang.Object  key)
Removes an attribute from the set. If the attribute is a StyleConstants attribute, the request will be converted to a CSS attribute prior to forwarding to the superclass behavior.

Specified by:
removeAttribute sample code for javax.swing.text.AbstractDocument.AttributeContext.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object) definition code for javax.swing.text.AbstractDocument.AttributeContext.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object) in interface AbstractDocument.AttributeContext sample code for javax.swing.text.AbstractDocument.AttributeContext definition code for javax.swing.text.AbstractDocument.AttributeContext
Overrides:
removeAttribute sample code for javax.swing.text.StyleContext.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object) definition code for javax.swing.text.StyleContext.removeAttribute(javax.swing.text.AttributeSet, java.lang.Object) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
old - the old set of attributes
key - the non-null attribute name
Returns:
the updated attribute set
See Also:
MutableAttributeSet.removeAttribute(java.lang.Object) sample code for javax.swing.text.MutableAttributeSet.removeAttribute(java.lang.Object) definition code for javax.swing.text.MutableAttributeSet.removeAttribute(java.lang.Object)

removeAttributes sample code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration<?>) definition code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration<?>)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  removeAttributes(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old,
                                     Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <?> names)
Removes a set of attributes for the element. If any of the attributes is a StyleConstants attribute, the request will be converted to a CSS attribute prior to forwarding to the superclass behavior.

Specified by:
removeAttributes sample code for javax.swing.text.AbstractDocument.AttributeContext.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration) definition code for javax.swing.text.AbstractDocument.AttributeContext.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration) in interface AbstractDocument.AttributeContext sample code for javax.swing.text.AbstractDocument.AttributeContext definition code for javax.swing.text.AbstractDocument.AttributeContext
Overrides:
removeAttributes sample code for javax.swing.text.StyleContext.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration) definition code for javax.swing.text.StyleContext.removeAttributes(javax.swing.text.AttributeSet, java.util.Enumeration) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
old - the old attribute set
names - the attribute names
Returns:
the updated attribute set
See Also:
MutableAttributeSet.removeAttributes(java.util.Enumeration) sample code for javax.swing.text.MutableAttributeSet.removeAttributes(java.util.Enumeration) definition code for javax.swing.text.MutableAttributeSet.removeAttributes(java.util.Enumeration)

removeAttributes sample code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet)

public AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  removeAttributes(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  old,
                                     AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  attrs)
Removes a set of attributes. If any of the attributes is a StyleConstants attribute, the request will be converted to a CSS attribute prior to forwarding to the superclass behavior.

Specified by:
removeAttributes sample code for javax.swing.text.AbstractDocument.AttributeContext.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.AttributeContext.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) in interface AbstractDocument.AttributeContext sample code for javax.swing.text.AbstractDocument.AttributeContext definition code for javax.swing.text.AbstractDocument.AttributeContext
Overrides:
removeAttributes sample code for javax.swing.text.StyleContext.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.removeAttributes(javax.swing.text.AttributeSet, javax.swing.text.AttributeSet) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
old - the old attribute set
attrs - the attributes
Returns:
the updated attribute set
See Also:
MutableAttributeSet.removeAttributes(java.util.Enumeration) sample code for javax.swing.text.MutableAttributeSet.removeAttributes(java.util.Enumeration) definition code for javax.swing.text.MutableAttributeSet.removeAttributes(java.util.Enumeration)

createSmallAttributeSet sample code for javax.swing.text.html.StyleSheet.createSmallAttributeSet(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.createSmallAttributeSet(javax.swing.text.AttributeSet)

protected StyleContext.SmallAttributeSet sample code for javax.swing.text.StyleContext.SmallAttributeSet definition code for javax.swing.text.StyleContext.SmallAttributeSet  createSmallAttributeSet(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Creates a compact set of attributes that might be shared. This is a hook for subclasses that want to alter the behavior of SmallAttributeSet. This can be reimplemented to return an AttributeSet that provides some sort of attribute conversion.

Overrides:
createSmallAttributeSet sample code for javax.swing.text.StyleContext.createSmallAttributeSet(javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.createSmallAttributeSet(javax.swing.text.AttributeSet) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
a - The set of attributes to be represented in the the compact form.

createLargeAttributeSet sample code for javax.swing.text.html.StyleSheet.createLargeAttributeSet(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.createLargeAttributeSet(javax.swing.text.AttributeSet)

protected MutableAttributeSet sample code for javax.swing.text.MutableAttributeSet definition code for javax.swing.text.MutableAttributeSet  createLargeAttributeSet(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Creates a large set of attributes that should trade off space for time. This set will not be shared. This is a hook for subclasses that want to alter the behavior of the larger attribute storage format (which is SimpleAttributeSet by default). This can be reimplemented to return a MutableAttributeSet that provides some sort of attribute conversion.

Overrides:
createLargeAttributeSet sample code for javax.swing.text.StyleContext.createLargeAttributeSet(javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.createLargeAttributeSet(javax.swing.text.AttributeSet) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
a - The set of attributes to be represented in the the larger form.

getFont sample code for javax.swing.text.html.StyleSheet.getFont(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getFont(javax.swing.text.AttributeSet)

public Font sample code for java.awt.Font definition code for java.awt.Font  getFont(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Fetches the font to use for the given set of attributes.

Overrides:
getFont sample code for javax.swing.text.StyleContext.getFont(javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.getFont(javax.swing.text.AttributeSet) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
a - the attribute set
Returns:
the font

getForeground sample code for javax.swing.text.html.StyleSheet.getForeground(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getForeground(javax.swing.text.AttributeSet)

public Color sample code for java.awt.Color definition code for java.awt.Color  getForeground(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Takes a set of attributes and turn it into a foreground color specification. This might be used to specify things like brighter, more hue, etc.

Overrides:
getForeground sample code for javax.swing.text.StyleContext.getForeground(javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.getForeground(javax.swing.text.AttributeSet) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
a - the set of attributes
Returns:
the color

getBackground sample code for javax.swing.text.html.StyleSheet.getBackground(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getBackground(javax.swing.text.AttributeSet)

public Color sample code for java.awt.Color definition code for java.awt.Color  getBackground(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Takes a set of attributes and turn it into a background color specification. This might be used to specify things like brighter, more hue, etc.

Overrides:
getBackground sample code for javax.swing.text.StyleContext.getBackground(javax.swing.text.AttributeSet) definition code for javax.swing.text.StyleContext.getBackground(javax.swing.text.AttributeSet) in class StyleContext sample code for javax.swing.text.StyleContext definition code for javax.swing.text.StyleContext
Parameters:
a - the set of attributes
Returns:
the color

getBoxPainter sample code for javax.swing.text.html.StyleSheet.getBoxPainter(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getBoxPainter(javax.swing.text.AttributeSet)

public StyleSheet.BoxPainter sample code for javax.swing.text.html.StyleSheet.BoxPainter definition code for javax.swing.text.html.StyleSheet.BoxPainter  getBoxPainter(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Fetches the box formatter to use for the given set of CSS attributes.


getListPainter sample code for javax.swing.text.html.StyleSheet.getListPainter(javax.swing.text.AttributeSet) definition code for javax.swing.text.html.StyleSheet.getListPainter(javax.swing.text.AttributeSet)

public StyleSheet.ListPainter sample code for javax.swing.text.html.StyleSheet.ListPainter definition code for javax.swing.text.html.StyleSheet.ListPainter  getListPainter(AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Fetches the list formatter to use for the given set of CSS attributes.


setBaseFontSize sample code for javax.swing.text.html.StyleSheet.setBaseFontSize(int) definition code for javax.swing.text.html.StyleSheet.setBaseFontSize(int)

public void setBaseFontSize(int sz)
Sets the base font size, with valid values between 1 and 7.


setBaseFontSize sample code for javax.swing.text.html.StyleSheet.setBaseFontSize(java.lang.String) definition code for javax.swing.text.html.StyleSheet.setBaseFontSize(java.lang.String)

public void setBaseFontSize(String sample code for java.lang.String definition code for java.lang.String  size)
Sets the base font size from the passed in String. The string can either identify a specific font size, with legal values between 1 and 7, or identifiy a relative font size such as +1 or -2.


getIndexOfSize sample code for javax.swing.text.html.StyleSheet.getIndexOfSize(float) definition code for javax.swing.text.html.StyleSheet.getIndexOfSize(float)

public static int getIndexOfSize(float pt)

getPointSize sample code for javax.swing.text.html.StyleSheet.getPointSize(int) definition code for javax.swing.text.html.StyleSheet.getPointSize(int)

public float getPointSize(int index)
Returns the point size, given a size index.


getPointSize sample code for javax.swing.text.html.StyleSheet.getPointSize(java.lang.String) definition code for javax.swing.text.html.StyleSheet.getPointSize(java.lang.String)

public float getPointSize(String sample code for java.lang.String definition code for java.lang.String  size)
Given a string such as "+2", "-2", or "2", returns a point size value.


stringToColor sample code for javax.swing.text.html.StyleSheet.stringToColor(java.lang.String) definition code for javax.swing.text.html.StyleSheet.stringToColor(java.lang.String)

public Color sample code for java.awt.Color definition code for java.awt.Color  stringToColor(String sample code for java.lang.String definition code for java.lang.String  string)
Converts a color string such as "RED" or "#NNNNNN" to a Color. Note: This will only convert the HTML3.2 color strings or a string of length 7; otherwise, it will return null.