javax.swing.text.html
public class StyleSheet extends StyleContext
Modifier and Type | Class and Description |
---|---|
static class |
StyleSheet.BoxPainter
This class carries out some of the duties of CSS formatting.
|
static class |
StyleSheet.ListPainter
This class carries out some of the CSS list formatting duties.
|
StyleContext.NamedStyle, StyleContext.SmallAttributeSet
DEFAULT_STYLE
Constructor and Description |
---|
StyleSheet()
Constructs a StyleSheet.
|
Modifier and Type | Method and Description |
---|---|
AttributeSet |
addAttribute(AttributeSet old,
Object key,
Object value)
Adds an attribute to the given set and returns a new set.
|
AttributeSet |
addAttributes(AttributeSet old,
AttributeSet attr)
Adds a set of attributes to the element.
|
void |
addCSSAttribute(MutableAttributeSet attr,
CSS.Attribute key,
String value)
Adds a CSS attribute to the given set.
|
boolean |
addCSSAttributeFromHTML(MutableAttributeSet attr,
CSS.Attribute key,
String value)
Adds a CSS attribute to the given set.
|
void |
addRule(String rule)
Adds a set of rules to the sheet.
|
void |
addStyleSheet(StyleSheet ss)
Adds the rules from ss to those of the receiver. ss's rules will
override the old rules.
|
protected MutableAttributeSet |
createLargeAttributeSet(AttributeSet a)
Creates a large set of attributes.
|
protected StyleContext.SmallAttributeSet |
createSmallAttributeSet(AttributeSet a)
Creates a compact set of attributes that might be shared.
|
Color |
getBackground(AttributeSet a)
Takes a set of attributes and turns it into a background
color specification.
|
URL |
getBase()
Gets the base url.
|
StyleSheet.BoxPainter |
getBoxPainter(AttributeSet a)
Gets the box formatter to use for the given set of CSS attributes.
|
AttributeSet |
getDeclaration(String decl)
Translates a CSS declaration into an AttributeSet.
|
Font |
getFont(AttributeSet a)
Gets the font to use for the given set.
|
Color |
getForeground(AttributeSet a)
Takes a set of attributes and turns it into a foreground
color specification.
|
static int |
getIndexOfSize(float pt)
TODO
|
StyleSheet.ListPainter |
getListPainter(AttributeSet a)
Gets the list formatter to use for the given set of CSS attributes.
|
float |
getPointSize(int index)
Gets the point size, given a size index.
|
float |
getPointSize(String size)
Given the string of the size, returns the point size value.
|
Style |
getRule(HTML.Tag t,
Element e)
Gets the style used to render the given tag.
|
Style |
getRule(String selector)
Gets the rule that best matches the selector. selector is a space
separated String of element names.
|
StyleSheet[] |
getStyleSheets()
Returns an array of the linked StyleSheets.
|
AttributeSet |
getViewAttributes(View v)
Gets a set of attributes to use in the view.
|
void |
importStyleSheet(URL url)
Imports a style sheet from the url.
|
void |
loadRules(Reader in,
URL ref)
Loads a set of rules that have been specified in terms of CSS grammar.
|
AttributeSet |
removeAttribute(AttributeSet old,
Object key)
Removes an attribute from the set.
|
AttributeSet |
removeAttributes(AttributeSet old,
AttributeSet attrs)
Removes an attribute from the set.
|
AttributeSet |
removeAttributes(AttributeSet old,
Enumeration<?> names)
Removes a set of attributes for the element.
|
void |
removeStyle(String nm)
Removes a style previously added.
|
void |
removeStyleSheet(StyleSheet ss)
Removes ss from those of the receiver
|
void |
setBase(URL base)
Sets the base url.
|
void |
setBaseFontSize(int sz)
Sets the base font size between 1 and 7.
|
void |
setBaseFontSize(String size)
Sets the base font size from the String.
|
Color |
stringToColor(String colorName)
Convert the color string represenation into java.awt.Color.
|
AttributeSet |
translateHTMLToCSS(AttributeSet htmlAttrSet)
Converts a set of HTML attributes to an equivalent set of CSS attributes.
|
addChangeListener, addStyle, getChangeListeners, getCompressionThreshold, getDefaultStyleContext, getEmptySet, getFont, getFontMetrics, getStaticAttribute, getStaticAttributeKey, getStyle, getStyleNames, readAttributes, readAttributeSet, reclaim, registerStaticAttributeKey, removeChangeListener, toString, writeAttributes, writeAttributeSet
public StyleSheet()
public Style getRule(HTML.Tag t, Element e)
t
- - the tag to translate to visual attributese
- - the element representing the tagpublic Style getRule(String selector)
selector
- - the element names separated by spaces