Book Home Java Enterprise in a Nutshell Search this book

Chapter 31. The javax.swing.text.html Package

The javax.swing.text.html package defines classes to support the display and editing of HTML documents. The key class is HTMLEditorKit, which is used to customize a javax.swing.JEditorPane component to work with HTML. Figure 31-1 shows the class hierarchy of this package. See Chapter 3, "Swing Programming Topics", for a discussion and example of using the HTMLEditorKit.

figure

Figure 31-1. The javax.swing.text.html package

BlockViewJava 1.2
javax.swing.text.html

This View implementation displays HTML block elements and can handle CSS attributes for those elements.

public class BlockView extends BoxView {
// Public Constructors
public BlockView (javax.swing.text.Element elem, int axis);
// Public Methods Overriding BoxView
public float getAlignment (int axis);
public int getResizeWeight (int axis);
public void paint (java.awt.Graphics g, java.awt.Shape allocation);
// Protected Methods Overriding BoxView
protected SizeRequirements calculateMajorAxisRequirements (int axis, SizeRequirements r);
protected SizeRequirements calculateMinorAxisRequirements (int axis, SizeRequirements r);
// Public Methods Overriding CompositeView
public void changedUpdate (javax.swing.event.DocumentEvent changes, java.awt.Shape a, ViewFactory f);
// Public Methods Overriding View
public AttributeSet getAttributes ();
// Protected Instance Methods
protected StyleSheet getStyleSheet ();
protected void setPropertiesFromAttributes ();
}

Hierarchy: Object-->View(SwingConstants)-->CompositeView-->BoxView-->BlockView

Subclasses: ListView

CSSJava 1.2
javax.swing.text.html

This class defines an inner class that is used to represent Cascading Style Sheet (CSS) attributes in an AttributeSet. It also defines static methods that return all defined CSS attribute objects and allow you to look up a CSS attribute object by name.

public class CSS {
// Public Constructors
public CSS ();
// Inner Classes
;
// Public Class Methods
public static CSS.Attribute[ ] getAllAttributeKeys ();
public static final CSS.Attribute getAttribute (String name);
}
CSS.AttributeJava 1.2
javax.swing.text.html

Instances of this class are used as key values in an AttributeSet to represent CSS attributes. Each CSS.Attribute object supports getDefaultValue() and isInherited() methods that return more information about the attribute. In addition, the toString() method returns the name of the attribute. The CSS.Attribute class is final and does not have a public constructor, so it cannot be instantiated or subclassed. However, it defines constant object values for each of the CSS attributes specified by the CSS specification.

public static final class CSS.Attribute {
// No Constructor
// Public Constants
public static final CSS.Attribute BACKGROUND ;
public static final CSS.Attribute BACKGROUND_ATTACHMENT ;
public static final CSS.Attribute BACKGROUND_COLOR ;
public static final CSS.Attribute BACKGROUND_IMAGE ;
public static final CSS.Attribute BACKGROUND_POSITION ;
public static final CSS.Attribute BACKGROUND_REPEAT ;
public static final CSS.Attribute BORDER ;
public static final CSS.Attribute BORDER_BOTTOM ;
public static final CSS.Attribute BORDER_BOTTOM_WIDTH ;
public static final CSS.Attribute BORDER_COLOR ;
public static final CSS.Attribute BORDER_LEFT ;
public static final CSS.Attribute BORDER_LEFT_WIDTH ;
public static final CSS.Attribute BORDER_RIGHT ;
public static final CSS.Attribute BORDER_RIGHT_WIDTH ;
public static final CSS.Attribute BORDER_STYLE ;
public static final CSS.Attribute BORDER_TOP ;
public static final CSS.Attribute BORDER_TOP_WIDTH ;
public static final CSS.Attribute BORDER_WIDTH ;
public static final CSS.Attribute CLEAR ;
public static final CSS.Attribute COLOR ;
public static final CSS.Attribute DISPLAY ;
public static final CSS.Attribute FLOAT ;
public static final CSS.Attribute FONT ;
public static final CSS.Attribute FONT_FAMILY ;
public static final CSS.Attribute FONT_SIZE ;
public static final CSS.Attribute FONT_STYLE ;
public static final CSS.Attribute FONT_VARIANT ;
public static final CSS.Attribute FONT_WEIGHT ;
public static final CSS.Attribute HEIGHT ;
public static final CSS.Attribute LETTER_SPACING ;
public static final CSS.Attribute LINE_HEIGHT ;
public static final CSS.Attribute LIST_STYLE ;
public static final CSS.Attribute LIST_STYLE_IMAGE ;
public static final CSS.Attribute LIST_STYLE_POSITION ;
public static final CSS.Attribute LIST_STYLE_TYPE ;
public static final CSS.Attribute MARGIN ;
public static final CSS.Attribute MARGIN_BOTTOM ;
public static final CSS.Attribute MARGIN_LEFT ;
public static final CSS.Attribute MARGIN_RIGHT ;
public static final CSS.Attribute MARGIN_TOP ;
public static final CSS.Attribute PADDING ;
public static final CSS.Attribute PADDING_BOTTOM ;
public static final CSS.Attribute PADDING_LEFT ;
public static final CSS.Attribute PADDING_RIGHT ;
public static final CSS.Attribute PADDING_TOP ;
public static final CSS.Attribute TEXT_ALIGN ;
public static final CSS.Attribute TEXT_DECORATION ;
public static final CSS.Attribute TEXT_INDENT ;
public static final CSS.Attribute TEXT_TRANSFORM ;
public static final CSS.Attribute VERTICAL_ALIGN ;
public static final CSS.Attribute WHITE_SPACE ;
public static final CSS.Attribute WIDTH ;
public static final CSS.Attribute WORD_SPACING ;
// Public Instance Methods
public String getDefaultValue ();
public boolean isInherited ();
// Public Methods Overriding Object
public String toString ();
}

Returned By: CSS.{getAllAttributeKeys(), getAttribute()}

Type Of: Too many fields to list.

FormViewJava 1.2
javax.swing.text.html

This View displays <INPUT>, <SELECT>, and <TEXTAREA> elements within an HTML <FORM>.

public class FormView extends ComponentView implements java.awt.event.ActionListener {
// Public Constructors
public FormView (javax.swing.text.Element elem);
// Public Constants
public static final String RESET ;
public static final String SUBMIT ;
// Inner Classes
;
// Methods Implementing ActionListener
public void actionPerformed (java.awt.event.ActionEvent evt);
// Protected Methods Overriding ComponentView
protected Component createComponent ();
// Protected Instance Methods
protected void imageSubmit (String imageData);
protected void submitData (String data);
}

Hierarchy: Object-->View(SwingConstants)-->ComponentView-->FormView(java.awt.event.ActionListener(java.util.EventListener))

FormView.MouseEventListenerJava 1.2
javax.swing.text.html

This class is used internally by FormView to handle clicks on HTML <INPUT> tags that have the TYPE=image attribute specified.

protected class FormView.MouseEventListener extends java.awt.event.MouseAdapter {
// Protected Constructors
protected MouseEventListener ();
// Public Methods Overriding MouseAdapter
public void mouseReleased (java.awt.event.MouseEvent evt);
}
HTMLJava 1.2
javax.swing.text.html

This class defines inner classes that are used to represent HTML tags and attributes. It also defines several static convenience methods that are used with the inner classes. In particular, getAttributeKey() and getTag() look up HTML.Attribute and HTML.Tag values by name.

public class HTML {
// Public Constructors
public HTML ();
// Public Constants
public static final String NULL_ATTRIBUTE_VALUE ; ="#DEFAULT"
// Inner Classes
;
;
;
// Public Class Methods
public static HTML.Attribute[ ] getAllAttributeKeys ();
public static HTML.Tag[ ] getAllTags ();
public static HTML.Attribute getAttributeKey (String attName);
public static int getIntegerAttributeValue (AttributeSet attr, HTML.Attribute key, int def);
public static HTML.Tag getTag (String tagName);
}
HTML.AttributeJava 1.2
javax.swing.text.html

This class defines a number of constant instances of itself to represent HTML attributes. The class has no public constructor and is final, so new attribute objects cannot be created by instantiation or subclassing.

public static final class HTML.Attribute {
// No Constructor
// Public Constants
public static final HTML.Attribute ACTION ;
public static final HTML.Attribute ALIGN ;
public static final HTML.Attribute ALINK ;
public static final HTML.Attribute ALT ;
public static final HTML.Attribute ARCHIVE ;
public static final HTML.Attribute BACKGROUND ;
public static final HTML.Attribute BGCOLOR ;
public static final HTML.Attribute BORDER ;
public static final HTML.Attribute CELLPADDING ;
public static final HTML.Attribute CELLSPACING ;
public static final HTML.Attribute CHECKED ;
public static final HTML.Attribute CLASS ;
public static final HTML.Attribute CLASSID ;
public static final HTML.Attribute CLEAR ;
public static final HTML.Attribute CODE ;
public static final HTML.Attribute CODEBASE ;
public static final HTML.Attribute CODETYPE ;
public static final HTML.Attribute COLOR ;
public static final HTML.Attribute COLS ;
public static final HTML.Attribute COLSPAN ;
public static final HTML.Attribute COMMENT ;
public static final HTML.Attribute COMPACT ;
public static final HTML.Attribute CONTENT ;
public static final HTML.Attribute COORDS ;
public static final HTML.Attribute DATA ;
public static final HTML.Attribute DECLARE ;
public static final HTML.Attribute DIR ;
public static final HTML.Attribute DUMMY ;
public static final HTML.Attribute ENCTYPE ;
public static final HTML.Attribute ENDTAG ;
public static final HTML.Attribute FACE ;
public static final HTML.Attribute FRAMEBORDER ;
public static final HTML.Attribute HALIGN ;
public static final HTML.Attribute HEIGHT ;
public static final HTML.Attribute HREF ;
public static final HTML.Attribute HSPACE ;
public static final HTML.Attribute HTTPEQUIV ;
public static final HTML.Attribute ID ;
public static final HTML.Attribute ISMAP ;
public static final HTML.Attribute LANG ;
public static final HTML.Attribute LANGUAGE ;
public static final HTML.Attribute LINK ;
public static final HTML.Attribute LOWSRC ;
public static final HTML.Attribute MARGINHEIGHT ;
public static final HTML.Attribute MARGINWIDTH ;
public static final HTML.Attribute MAXLENGTH ;
public static final HTML.Attribute METHOD ;
public static final HTML.Attribute MULTIPLE ;
public static final HTML.Attribute N ;
public static final HTML.Attribute NAME ;
public static final HTML.Attribute NOHREF ;
public static final HTML.Attribute NORESIZE ;
public static final HTML.Attribute NOSHADE ;
public static final HTML.Attribute NOWRAP ;
public static final HTML.Attribute PROMPT ;
public static final HTML.Attribute REL ;
public static final HTML.Attribute REV ;
public static final HTML.Attribute ROWS ;
public static final HTML.Attribute ROWSPAN ;
public static final HTML.Attribute SCROLLING ;
public static final HTML.Attribute SELECTED ;
public static final HTML.Attribute SHAPE ;
public static final HTML.Attribute SHAPES ;
public static final HTML.Attribute SIZE ;
public static final HTML.Attribute SRC ;
public static final HTML.Attribute STANDBY ;
public static final HTML.Attribute START ;
public static final HTML.Attribute STYLE ;
public static final HTML.Attribute TARGET ;
public static final HTML.Attribute TEXT ;
public static final HTML.Attribute TITLE ;
public static final HTML.Attribute TYPE ;
public static final HTML.Attribute USEMAP ;
public static final HTML.Attribute VALIGN ;
public static final HTML.Attribute VALUE ;
public static final HTML.Attribute VALUETYPE ;
public static final HTML.Attribute VERSION ;
public static final HTML.Attribute VLINK ;
public static final HTML.Attribute VSPACE ;
public static final HTML.Attribute WIDTH ;
// Public Methods Overriding Object
public String toString ();
}

Passed To: HTML.getIntegerAttributeValue()

Returned By: HTML.{getAllAttributeKeys(), getAttributeKey()}

Type Of: Too many fields to list.

HTML.TagJava 1.2
javax.swing.text.html

This class defines constant instances of itself that represent HTML tags. The breaksFlow(), isBlock(), and isPreformatted() methods return additional information about the basic behavior of each tag. HTML.Tag defines constants for all of the standard HTML tags. It can be subclassed to add support for custom tags used with a customized HTML parser.

public static class HTML.Tag {
// Protected Constructors
protected Tag (String id);
protected Tag (String id, boolean causesBreak, boolean isBlock);
// Public Constants
public static final HTML.Tag A ;
public static final HTML.Tag ADDRESS ;
public static final HTML.Tag APPLET ;
public static final HTML.Tag AREA ;
public static final HTML.Tag B ;
public static final HTML.Tag BASE ;
public static final HTML.Tag BASEFONT ;
public static final HTML.Tag BIG ;
public static final HTML.Tag BLOCKQUOTE ;
public static final HTML.Tag BODY ;
public static final HTML.Tag BR ;
public static final HTML.Tag CAPTION ;
public static final HTML.Tag CENTER ;
public static final HTML.Tag CITE ;
public static final HTML.Tag CODE ;
public static final HTML.Tag COMMENT ;
public static final HTML.Tag CONTENT ;
public static final HTML.Tag DD ;
public static final HTML.Tag DFN ;
public static final HTML.Tag DIR ;
public static final HTML.Tag DIV ;
public static final HTML.Tag DL ;
public static final HTML.Tag DT ;
public static final HTML.Tag EM ;
public static final HTML.Tag FONT ;
public static final HTML.Tag FORM ;
public static final HTML.Tag FRAME ;
public static final HTML.Tag FRAMESET ;
public static final HTML.Tag H1 ;
public static final HTML.Tag H2 ;
public static final HTML.Tag H3 ;
public static final HTML.Tag H4 ;
public static final HTML.Tag H5 ;
public static final HTML.Tag H6 ;
public static final HTML.Tag HEAD ;
public static final HTML.Tag HR ;
public static final HTML.Tag HTML ;
public static final HTML.Tag I ;
public static final HTML.Tag IMG ;
public static final HTML.Tag IMPLIED ;
public static final HTML.Tag INPUT ;
public static final HTML.Tag ISINDEX ;
public static final HTML.Tag KBD ;
public static final HTML.Tag LI ;
public static final HTML.Tag LINK ;
public static final HTML.Tag MAP ;
public static final HTML.Tag MENU ;
public static final HTML.Tag META ;
public static final HTML.Tag NOFRAMES ;
public static final HTML.Tag OBJECT ;
public static final HTML.Tag OL ;
public static final HTML.Tag OPTION ;
public static final HTML.Tag P ;
public static final HTML.Tag PARAM ;
public static final HTML.Tag PRE ;
public static final HTML.Tag S ;
public static final HTML.Tag SAMP ;
public static final HTML.Tag SCRIPT ;
public static final HTML.Tag SELECT ;
public static final HTML.Tag SMALL ;
public static final HTML.Tag STRIKE ;
public static final HTML.Tag STRONG ;
public static final HTML.Tag STYLE ;
public static final HTML.Tag SUB ;
public static final HTML.Tag SUP ;
public static final HTML.Tag TABLE ;
public static final HTML.Tag TD ;
public static final HTML.Tag TEXTAREA ;
public static final HTML.Tag TH ;
public static final HTML.Tag TITLE ;
public static final HTML.Tag TR ;
public static final HTML.Tag TT ;
public static final HTML.Tag U ;
public static final HTML.Tag UL ;
public static final HTML.Tag VAR ;
// Public Instance Methods
public boolean breaksFlow ();
public boolean isBlock ();
public boolean isPreformatted ();
// Public Methods Overriding Object
public String toString ();
}

Subclasses: HTML.UnknownTag

Passed To: Too many methods to list.

Returned By: HTML.{getAllTags(), getTag()}, HTMLDocument.Iterator.getTag(), javax.swing.text.html.parser.TagElement.getHTMLTag()

Type Of: Too many fields to list.

HTML.UnknownTagJava 1.2
javax.swing.text.htmlserializable

This HTML.Tag subclass is used to represent nonstandard tags that the HTML parser does not recognize.

public static class HTML.UnknownTag extends HTML.Tag implements Serializable {
// Public Constructors
public UnknownTag (String id);
// Public Methods Overriding Object
public boolean equals (Object obj);
public int hashCode ();
}
HTMLDocumentJava 1.2
javax.swing.text.htmlserializable

This class represents an HTML document, optionally augmented with CSS style sheets. The document is composed of a tree of BlockElement and RunElement objects, each of which has an HTML.Tag object specified as the value of its StyleContext.NameAttribute attribute. setBase() specifies a base URL relative to which hyperlinks in the document are interpreted. setTokenThreshold() specifies how many parsed tokens should be parsed before they are inserted into the document. setPreservesUnknownTags() specifies whether unknown tags in a document should be saved in the document structure or discarded. If you are not writing the document back out, they usually can be discarded. getStyleSheet() returns a StyleSheet object that represents any CSS style sheet that appeared in the document itself. getIterator() returns an HTMLDocument.Iterator object that can be used to find all tags of a given type in the document. The getReader() methods return an HTMLDocument.HTMLReader object that converts method calls from the HTML parser into document elements. Subclasses that want to perform customized HTML parsing should override these methods to return an appropriately customized subclass of HTMLReader.

public class HTMLDocument extends DefaultStyledDocument {
// Public Constructors
public HTMLDocument ();
public HTMLDocument (StyleSheet styles);
public HTMLDocument (AbstractDocument.Content c, StyleSheet styles);
// Public Constants
public static final String AdditionalComments ; ="AdditionalComments"
// Inner Classes
;
;
;
;
// Property Accessor Methods (by property name)
public java.net.URL getBase (); default:null
public void setBase (java.net.URL u);
public boolean getPreservesUnknownTags (); default:true
public void setPreservesUnknownTags (boolean preservesTags);
public StyleSheet getStyleSheet ();
public int getTokenThreshold (); default:2147483647
public void setTokenThreshold (int n);
// Public Instance Methods
public HTMLDocument.Iterator getIterator (HTML.Tag t);
public HTMLEditorKit.ParserCallback getReader (int pos);
public HTMLEditorKit.ParserCallback getReader (int pos, int popDepth, int pushDepth, HTML.Tag insertTag);
public void processHTMLFrameHyperlinkEvent (HTMLFrameHyperlinkEvent e);
// Public Methods Overriding DefaultStyledDocument
public void setParagraphAttributes (int offset, int length, AttributeSet s, boolean replace);
// Protected Methods Overriding DefaultStyledDocument
protected void create (DefaultStyledDocument.ElementSpec[ ] data);
protected AbstractDocument.AbstractElement createDefaultRoot ();
protected void insert (int offset, DefaultStyledDocument.ElementSpec[ ] data) throws BadLocationException;
protected void insertUpdate (AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr);
// Protected Methods Overriding AbstractDocument
protected javax.swing.text.Element createBranchElement (javax.swing.text.Element parent, AttributeSet a);
protected javax.swing.text.Element createLeafElement (javax.swing.text.Element parent, AttributeSet a, int p0, int p1);
protected void fireChangedUpdate (javax.swing.event.DocumentEvent e);
protected void fireUndoableEditUpdate (javax.swing.event.UndoableEditEvent e);
}

Hierarchy: Object-->AbstractDocument(Document,Serializable)-->DefaultStyledDocument(StyledDocument(Document))-->HTMLDocument

Passed To: HTMLEditorKit.insertHTML(), HTMLEditorKit.HTMLTextAction.{elementCountToTag(), findElementMatchingTag(), getElementsAt()}, HTMLEditorKit.InsertHTMLTextAction.{insertAtBoundry(), insertHTML()}, HTMLWriter.HTMLWriter()

Returned By: HTMLEditorKit.HTMLTextAction.getHTMLDocument()

HTMLDocument.BlockElementJava 1.2
javax.swing.text.htmlserializable

This class is used to represent block elements (i.e., elements that contain other elements) of an HTML document.

public class HTMLDocument.BlockElement extends AbstractDocument.BranchElement {
// Public Constructors
public BlockElement (javax.swing.text.Element parent, AttributeSet a);
// Public Methods Overriding AbstractDocument.BranchElement
public String getName ();
// Public Methods Overriding AbstractDocument.AbstractElement
public AttributeSet getResolveParent (); constant
}
HTMLDocument.HTMLReaderJava 1.2
javax.swing.text.html

This class implements the HTMLEditorKit.ParserCallback interface and serves as an adapter between the HTML parser of the javax.swing.text.html.parser package and the HTMLDocument class. The parser invokes methods of the HTMLReader object, and the HTMLReader is responsible for converting those methods into content in the HTMLDocument. This class defines a number of inner classes of type HTMLDocument.HTMLReader.TagAction. These classes define special code to be executed when the parser encounters particular start and end tags. HTMLDocument.HTMLReader subclasses can perform customized HTML parsing by defining new TagAction subclasses and associating them with specific HTML tags by calling registerTag().

public class HTMLDocument.HTMLReader extends HTMLEditorKit.ParserCallback {
// Public Constructors
public HTMLReader (int offset);
public HTMLReader (int offset, int popDepth, int pushDepth, HTML.Tag insertTag);
// Inner Classes
;
;
;
;
;
;
;
;
;
// Public Methods Overriding HTMLEditorKit.ParserCallback
public void flush () throws BadLocationException;
public void handleComment (char[ ] data, int pos);
public void handleEndTag (HTML.Tag t, int pos);
public void handleSimpleTag (HTML.Tag t, MutableAttributeSet a, int pos);
public void handleStartTag (HTML.Tag t, MutableAttributeSet a, int pos);
public void handleText (char[ ] data, int pos);
// Protected Instance Methods
protected void addContent (char[ ] data, int offs, int length);
protected void addContent (char[ ] data, int offs, int length, boolean generateImpliedPIfNecessary);
protected void addSpecialElement (HTML.Tag t, MutableAttributeSet a);
protected void blockClose (HTML.Tag t);
protected void blockOpen (HTML.Tag t, MutableAttributeSet attr);
protected void popCharacterStyle ();
protected void preContent (char[ ] data);
protected void pushCharacterStyle ();
protected void registerTag (HTML.Tag t, HTMLDocument.HTMLReader.TagAction a);
protected void textAreaContent (char[ ] data);
// Protected Instance Fields
protected MutableAttributeSet charAttr ;
protected java.util.Vector parseBuffer ;
}
HTMLDocument.HTMLReader.BlockActionJava 1.2
javax.swing.text.html

This TagAction handles blocks, such as <TD> and <DIV> tags.

public class HTMLDocument.HTMLReader.BlockAction extends HTMLDocument.HTMLReader.TagAction {
// Public Constructors
public BlockAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.TagAction
public void end (HTML.Tag t);
public void start (HTML.Tag t, MutableAttributeSet attr);
}

Subclasses: HTMLDocument.HTMLReader.ParagraphAction, HTMLDocument.HTMLReader.PreAction

HTMLDocument.HTMLReader.CharacterActionJava 1.2
javax.swing.text.html

This TagAction handles character elements, such as <B> and <FONT> tags.

public class HTMLDocument.HTMLReader.CharacterAction extends HTMLDocument.HTMLReader.TagAction {
// Public Constructors
public CharacterAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.TagAction
public void end (HTML.Tag t);
public void start (HTML.Tag t, MutableAttributeSet attr);
}
HTMLDocument.HTMLReader.FormActionJava 1.2
javax.swing.text.html

This TagAction handles form elements, such as <INPUT> and <SELECT> tags.

public class HTMLDocument.HTMLReader.FormAction extends HTMLDocument.HTMLReader.SpecialAction {
// Public Constructors
public FormAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.SpecialAction
public void start (HTML.Tag t, MutableAttributeSet attr);
// Public Methods Overriding HTMLDocument.HTMLReader.TagAction
public void end (HTML.Tag t);
}
HTMLDocument.HTMLReader.HiddenActionJava 1.2
javax.swing.text.html

This TagAction handles elements that have no visual appearance, such as <LINK> and <MAP> tags.

public class HTMLDocument.HTMLReader.HiddenAction extends HTMLDocument.HTMLReader.TagAction {
// Public Constructors
public HiddenAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.TagAction
public void end (HTML.Tag t);
public void start (HTML.Tag t, MutableAttributeSet a);
}
HTMLDocument.HTMLReader.IsindexActionJava 1.2
javax.swing.text.html

This TagAction handles the <ISINDEX> tag.

public class HTMLDocument.HTMLReader.IsindexAction extends HTMLDocument.HTMLReader.TagAction {
// Public Constructors
public IsindexAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.TagAction
public void start (HTML.Tag t, MutableAttributeSet a);
}
HTMLDocument.HTMLReader.ParagraphActionJava 1.2
javax.swing.text.html

This TagAction handles paragraph elements, such as <P> and <H1> tags.

public class HTMLDocument.HTMLReader.ParagraphAction extends HTMLDocument.HTMLReader.BlockAction {
// Public Constructors
public ParagraphAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.BlockAction
public void end (HTML.Tag t);
public void start (HTML.Tag t, MutableAttributeSet a);
}
HTMLDocument.HTMLReader.PreActionJava 1.2
javax.swing.text.html

This TagAction handles the <PRE> tag.

public class HTMLDocument.HTMLReader.PreAction extends HTMLDocument.HTMLReader.BlockAction {
// Public Constructors
public PreAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.BlockAction
public void end (HTML.Tag t);
public void start (HTML.Tag t, MutableAttributeSet attr);
}
HTMLDocument.HTMLReader.SpecialActionJava 1.2
javax.swing.text.html

This TagAction handles elements that require special handling, such as <OBJECT> and <FRAME> tags.

public class HTMLDocument.HTMLReader.SpecialAction extends HTMLDocument.HTMLReader.TagAction {
// Public Constructors
public SpecialAction ();
// Public Methods Overriding HTMLDocument.HTMLReader.TagAction
public void start (HTML.Tag t, MutableAttributeSet a);
}

Subclasses: HTMLDocument.HTMLReader.FormAction

HTMLDocument.HTMLReader.TagActionJava 1.2
javax.swing.text.html

This class defines methods that are called when the HTML parser encounters start and end tags of a particular type. To customize HTML parsing, implement a subclass of TagAction, create an instance, and register it with an HTMLReader subclass by calling registerTag().

public class HTMLDocument.HTMLReader.TagAction {
// Public Constructors
public TagAction ();
// Public Instance Methods
public void end (HTML.Tag t); empty
public void start (HTML.Tag t, MutableAttributeSet a); empty
}

Subclasses: HTMLDocument.HTMLReader.BlockAction, HTMLDocument.HTMLReader.CharacterAction, HTMLDocument.HTMLReader.HiddenAction, HTMLDocument.HTMLReader.IsindexAction, HTMLDocument.HTMLReader.SpecialAction

Passed To: HTMLDocument.HTMLReader.registerTag()

HTMLDocument.IteratorJava 1.2
javax.swing.text.html

This class is used to iterate through an HTMLDocument, returning only tags of a specified type. This class is abstract and cannot be instantiated. Call the getIterator() method of HTMLDocument to obtain an instance that returns all instances of a specified HTML.Tag. getAttributes(), getStartOffset(), and getEndOffset() return information about the current tag. next() moves the iterator to the next tag, and isValid() returns true if there is a current tag or false if there are no more tags.

public abstract static class HTMLDocument.Iterator {
// Public Constructors
public Iterator ();
// Property Accessor Methods (by property name)
public abstract AttributeSet getAttributes ();
public abstract int getEndOffset ();
public abstract int getStartOffset ();
public abstract HTML.Tag getTag ();
public abstract boolean isValid ();
// Public Instance Methods
public abstract void next ();
}

Returned By: HTMLDocument.getIterator()

HTMLDocument.RunElementJava 1.2
javax.swing.text.htmlserializable

This class is used to represent content elements of an HTML document.

public class HTMLDocument.RunElement extends AbstractDocument.LeafElement {
// Public Constructors
public RunElement (javax.swing.text.Element parent, AttributeSet a, int offs0, int offs1);
// Public Methods Overriding AbstractDocument.LeafElement
public String getName ();
// Public Methods Overriding AbstractDocument.AbstractElement
public AttributeSet getResolveParent (); constant
}
HTMLEditorKitJava 1.2
javax.swing.text.htmlcloneable serializable

This class is used to customize a JEditorPane component to display and edit HTML documents. Most applications need do nothing more than instantiate an HTMLEditorKit and pass it to the setEditorKit() method of a JEditorPane. The write() method converts the contents of an HTMLDocument into HTML text and writes it to the specified stream. The read() method parses HTML text from a stream and creates a corresponding element structure in the specified HTMLDocument. insertHTML() parses HTML text from a string and inserts it into the specified HTMLDocument.

You can customize the appearance of HTML text displayed using an HTMLEditorKit by passing a StyleSheet object to setStyleSheet(). Other customizations require you to subclass HTMLEditorKit and override some of its methods. Override getViewFactory() if you want to use customized View subclasses to display certain HTML document elements. Override createDefaultDocument() if you want to change the properties of the default HTMLDocument or if you want to return a subclass of HTMLDocument. Override getParser() if you want to use a custom HTML parser implementation, instead of the default parser implemented in javax.swing.text.html.parser.

public class HTMLEditorKit extends StyledEditorKit {
// Public Constructors
public HTMLEditorKit ();
// Public Constants
public static final String BOLD_ACTION ; ="html-bold-action"
public static final String COLOR_ACTION ; ="html-color-action"
public static final String DEFAULT_CSS ; ="default.css"
public static final String FONT_CHANGE_BIGGER ; ="html-font-bigger"
public static final String FONT_CHANGE_SMALLER ; ="html-font-smaller"
public static final String IMG_ALIGN_BOTTOM ; ="html-image-align-bottom"
public static final String IMG_ALIGN_MIDDLE ; ="html-image-align-middle"
public static final String IMG_ALIGN_TOP ; ="html-image-align-top"
public static final String IMG_BORDER ; ="html-image-border"
public static final String ITALIC_ACTION ; ="html-italic-action"
public static final String LOGICAL_STYLE_ACTION ; ="html-logical-style-action"
public static final String PARA_INDENT_LEFT ; ="html-para-indent-left"
public static final String PARA_INDENT_RIGHT ; ="html-para-indent-right"
// Inner Classes
;
;
;
;
;
;
// Public Instance Methods
public StyleSheet getStyleSheet ();
public void insertHTML (HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag insertTag) throws BadLocationException, java.io.IOException;
public void setStyleSheet (StyleSheet s);
// Public Methods Overriding StyledEditorKit
public Object clone ();
public Document createDefaultDocument ();
public void deinstall (JEditorPane c);
public Action[ ] getActions ();
public MutableAttributeSet getInputAttributes (); default:NamedStyle
public ViewFactory getViewFactory (); default:HTMLFactory
public void install (JEditorPane c);
// Protected Methods Overriding StyledEditorKit
protected void createInputAttributes (javax.swing.text.Element element, MutableAttributeSet set);
// Public Methods Overriding DefaultEditorKit
public String getContentType (); default:"text/html"
public void read (java.io.Reader in, Document doc, int pos) throws java.io.IOException, BadLocationException;
public void write (java.io.Writer out, Document doc, int pos, int len) throws java.io.IOException, BadLocationException;
// Protected Instance Methods
protected HTMLEditorKit.Parser getParser ();
}

Hierarchy: Object-->EditorKit(Cloneable,Serializable)-->DefaultEditorKit-->StyledEditorKit-->HTMLEditorKit

Returned By: HTMLEditorKit.HTMLTextAction.getHTMLEditorKit()

HTMLEditorKit.HTMLFactoryJava 1.2
javax.swing.text.html

This class is a ViewFactory for HTML documents. Its create() method returns a View object that is appropriate for the display of a given Element object. The View object is an instance of one of the View subclasses defined in this package.

public static class HTMLEditorKit.HTMLFactory implements ViewFactory {
// Public Constructors
public HTMLFactory ();
// Methods Implementing ViewFactory
public View create (javax.swing.text.Element elem);
}
HTMLEditorKit.HTMLTextActionJava 1.2
javax.swing.text.htmlcloneable serializable

This class is an abstract Action implementation that provides protected convenience methods that may be helpful to Action implementations that manipulate or edit an HTMLDocument.

public abstract static class HTMLEditorKit.HTMLTextAction extends StyledEditorKit.StyledTextAction {
// Public Constructors
public HTMLTextAction (String name);
// Protected Instance Methods
protected int elementCountToTag (HTMLDocument doc, int offset, HTML.Tag tag);
protected javax.swing.text.Element findElementMatchingTag (HTMLDocument doc, int offset, HTML.Tag tag);
protected javax.swing.text.Element[ ] getElementsAt (HTMLDocument doc, int offset);
protected HTMLDocument getHTMLDocument (JEditorPane e);
protected HTMLEditorKit getHTMLEditorKit (JEditorPane e);
}

Subclasses: HTMLEditorKit.InsertHTMLTextAction

HTMLEditorKit.InsertHTMLTextActionJava 1.2
javax.swing.text.htmlcloneable serializable

This Action implementation can be used to insert HTML text into an HTML document at the current location. You can create custom instances of this class and bind them to KeyStroke objects to provide custom editing actions for your users. When you create an InsertHTMLTextAction instance, you must specify the string of HTML text to be inserted and two HTML.Tag objects. The first HTML.Tag specifies the parent tag of the inserted text. For example, if the text you are inserting belongs in a paragraph element, you specify HTML.Tag.P. If the text you are inserting is a <DIV> or a <TABLE>, you specify HTML.Tag.BODY. The second HTML.Tag you must specify is the first tag of the parsed HTML string that is actually being inserted. For example, you may want to insert only a <TD> tag but may have to specify an HTML string that contains <TABLE> and <TR> tags so that the parser can correctly parse the HTML text. In this case, your second HTML.Tag argument is HTML.Tag.TD.

public static class HTMLEditorKit.InsertHTMLTextAction extends HTMLEditorKit.HTMLTextAction {
// Public Constructors
public InsertHTMLTextAction (String name, String html, HTML.Tag parentTag, HTML.Tag addTag);
public InsertHTMLTextAction (String name, String html, HTML.Tag parentTag, HTML.Tag addTag, HTML.Tag alternateParentTag, HTML.Tag alternateAddTag);
// Public Methods Overriding AbstractAction
public void actionPerformed (java.awt.event.ActionEvent ae);
// Protected Instance Methods
protected void insertAtBoundry (JEditorPane editor, HTMLDocument doc, int offset, javax.swing.text.Element insertElement, String html, HTML.Tag parentTag, HTML.Tag addTag);
protected void insertHTML (JEditorPane editor, HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag addTag);
// Protected Instance Fields
protected HTML.Tag addTag ;
protected HTML.Tag alternateAddTag ;
protected HTML.Tag alternateParentTag ;
protected String html ;
protected HTML.Tag parentTag ;
}
HTMLEditorKit.LinkControllerJava 1.2
javax.swing.text.htmlserializable

This class is a MouseAdapter that listens for mouse clicks and responds when the user clicks the mouse on a hyperlink. An instance of this class is installed on a JEditorPane by the install() method of the HTMLEditorKit.

public static class HTMLEditorKit.LinkController extends java.awt.event.MouseAdapter implements Serializable {
// Public Constructors
public LinkController ();
// Public Methods Overriding MouseAdapter
public void mouseClicked (java.awt.event.MouseEvent e);
// Protected Instance Methods
protected void activateLink (int pos, JEditorPane editor);
}
HTMLEditorKit.ParserJava 1.2
javax.swing.text.html

This is the abstract superclass of any class that wants to serve as an HTML parser for an HTMLEditorKit. The parse() method must read HTML text from the specified stream and convert the structure of the HTML text into a sequence of calls to the appropriate methods of the specified HTMLEditorKit.ParserCallback object. It is the responsibility of the ParserCallback object to initialize the HTMLDocument as appropriate in response to those method calls. If the ignoreCharSet argument is true, the parser ignores any HTML <META> tags that specify the document encoding. If this argument is false and the parser encounters such a tag, it should compare the document-specified encoding to the encoding used by the Reader stream from which it is reading. If the encodings do not match, it should throw a javax.swing.text.ChangedCharSetException.

Most applications can rely on the full-featured HTML parser provided by the javax.swing.text.html.parser package and do not need to subclass this class. The default parser is DTD-driven and can also be customized by providing a custom DTD. If you implement your own Parser subclass or customize the default parser, you must subclass HTMLEditorKit and override the getParser() method.

public abstract static class HTMLEditorKit.Parser {
// Public Constructors
public Parser ();
// Public Instance Methods
public abstract void parse (java.io.Reader r, HTMLEditorKit.ParserCallback cb, boolean ignoreCharSet) throws java.io.IOException;
}

Subclasses: javax.swing.text.html.parser.ParserDelegator

Returned By: HTMLEditorKit.getParser()

HTMLEditorKit.ParserCallbackJava 1.2
javax.swing.text.html

This class defines the methods that are invoked by an HTMLEditorKit.Parser to describe the structure of an HTML document. The methods should be implemented to add appropriate content to an HTMLDocument. HTMLEditorKit uses an HTMLDocument.HTMLReader object as its default implementation of ParserCallback.

public static class HTMLEditorKit.ParserCallback {
// Public Constructors
public ParserCallback ();
// Public Instance Methods
public void flush () throws BadLocationException; empty
public void handleComment (char[ ] data, int pos); empty
public void handleEndTag (HTML.Tag t, int pos); empty
public void handleError (String errorMsg, int pos); empty
public void handleSimpleTag (HTML.Tag t, MutableAttributeSet a, int pos); empty
public void handleStartTag (HTML.Tag t, MutableAttributeSet a, int pos); empty
public void handleText (char[ ] data, int pos); empty
}

Subclasses: HTMLDocument.HTMLReader

Passed To: HTMLEditorKit.Parser.parse(), javax.swing.text.html.parser.DocumentParser.parse(), javax.swing.text.html.parser.ParserDelegator.parse()

Returned By: HTMLDocument.getReader()

HTMLFrameHyperlinkEventJava 1.2
javax.swing.text.htmlserializable event

This class is an extension of HyperlinkEvent that is used when a hyperlink in one frame refers to another frame with an HTML TARGET attribute. getSourceElement() returns the Element object in the HTMLDocument that corresponds to the <FRAME> tag of the source frame. getTarget() returns a string that specifies the target frame. This may be a frame name or one of the standard special target names, "_self", "_parent", or "_top". The processHTMLFrameHyperlinkEvent() method of HTMLDocument can handle events of this type.

public class HTMLFrameHyperlinkEvent extends javax.swing.event.HyperlinkEvent {
// Public Constructors
public HTMLFrameHyperlinkEvent (Object source, javax.swing.event.HyperlinkEvent.EventType type, java.net.URL targetURL, String targetFrame);
public HTMLFrameHyperlinkEvent (Object source, javax.swing.event.HyperlinkEvent.EventType type, java.net.URL targetURL, javax.swing.text.Element sourceElement, String targetFrame);
public HTMLFrameHyperlinkEvent (Object source, javax.swing.event.HyperlinkEvent.EventType type, java.net.URL targetURL, String desc, String targetFrame);
public HTMLFrameHyperlinkEvent (Object source, javax.swing.event.HyperlinkEvent.EventType type, java.net.URL targetURL, String desc, javax.swing.text.Element sourceElement, String targetFrame);
// Public Instance Methods
public javax.swing.text.Element getSourceElement ();
public String getTarget ();
}

Hierarchy: Object-->java.util.EventObject(Serializable)-->javax.swing.event.HyperlinkEvent-->HTMLFrameHyperlinkEvent

Passed To: HTMLDocument.processHTMLFrameHyperlinkEvent()

HTMLWriterJava 1.2
javax.swing.text.html

This class knows how to convert an HTMLDocument to textual form and write it to a specified stream. To use an HTMLWriter, simply pass an HTMLDocument and a Writer stream to the constructor, then call the public write() method. The various protected methods are used internally to output the document and can be overridden in a subclass to customize the HTML output process.

public class HTMLWriter extends AbstractWriter {
// Public Constructors
public HTMLWriter (java.io.Writer w, HTMLDocument doc);
public HTMLWriter (java.io.Writer w, HTMLDocument doc, int pos, int len);
// Public Methods Overriding AbstractWriter
public void write () throws java.io.IOException, BadLocationException;
// Protected Methods Overriding AbstractWriter
protected void decrIndent ();
protected void incrIndent ();
protected void indent () throws java.io.IOException;
protected void setIndentSpace (int space);
protected void setLineLength (int l);
protected void text (javax.swing.text.Element elem) throws BadLocationException, java.io.IOException;
protected void write (String content) throws java.io.IOException;
protected void write (char ch) throws java.io.IOException;
protected void writeAttributes (AttributeSet attr) throws java.io.IOException;
// Protected Instance Methods
protected void closeOutUnwantedEmbeddedTags (AttributeSet attr) throws java.io.IOException;
protected void comment (javax.swing.text.Element elem) throws BadLocationException, java.io.IOException;
protected void emptyTag (javax.swing.text.Element elem) throws BadLocationException, java.io.IOException;
protected void endTag (javax.swing.text.Element elem) throws java.io.IOException;
protected boolean isBlockTag (AttributeSet attr);
protected boolean matchNameAttribute (AttributeSet attr, HTML.Tag tag);
protected void selectContent (AttributeSet attr) throws java.io.IOException;
protected void startTag (javax.swing.text.Element elem) throws java.io.IOException, BadLocationException;
protected boolean synthesizedElement (javax.swing.text.Element elem);
protected void textAreaContent (AttributeSet attr) throws BadLocationException, java.io.IOException;
protected void writeEmbeddedTags (AttributeSet attr) throws java.io.IOException;
protected void writeOption (Option option) throws java.io.IOException;
}

Hierarchy: Object-->AbstractWriter-->HTMLWriter

InlineViewJava 1.2
javax.swing.text.html

This View class displays styled text that appears in an HTML document. It extends javax.swing.text.LabelView to add support for CSS attributes.

public class InlineView extends LabelView {
// Public Constructors
public InlineView (javax.swing.text.Element elem);
// Public Methods Overriding LabelView
public void changedUpdate (javax.swing.event.DocumentEvent e, java.awt.Shape a, ViewFactory f);
// Protected Methods Overriding LabelView
protected void setPropertiesFromAttributes ();
// Public Methods Overriding View
public AttributeSet getAttributes ();
// Protected Instance Methods
protected StyleSheet getStyleSheet ();
}

Hierarchy: Object-->View(SwingConstants)-->LabelView-->InlineView

ListViewJava 1.2
javax.swing.text.html

This View class displays HTML list elements.

public class ListView extends BlockView {
// Public Constructors
public ListView (javax.swing.text.Element elem);
// Public Methods Overriding BlockView
public float getAlignment (int axis);
public void paint (java.awt.Graphics g, java.awt.Shape allocation);
// Protected Methods Overriding BlockView
protected void setPropertiesFromAttributes ();
// Protected Methods Overriding BoxView
protected void paintChild (java.awt.Graphics g, java.awt.Rectangle alloc, int index);
}

Hierarchy: Object-->View(SwingConstants)-->CompositeView-->BoxView-->BlockView-->ListView

MinimalHTMLWriterJava 1.2
javax.swing.text.html

This class knows how to convert an arbitrary StyledDocument to simple HTML text. Its use is similar to the use of HTMLWriter. Because there is not an exact mapping between the character and paragraph attributes supported by StyledDocument objects and those defined by standard HTML tags and attributes, MinimalHTMLWriter relies heavily on CSS attributes in the HTML text it outputs.

public class MinimalHTMLWriter extends AbstractWriter {
// Public Constructors
public MinimalHTMLWriter (java.io.Writer w, StyledDocument doc);
public MinimalHTMLWriter (java.io.Writer w, StyledDocument doc, int pos, int len);
// Public Methods Overriding AbstractWriter
public void write () throws java.io.IOException, BadLocationException;
// Protected Methods Overriding AbstractWriter
protected void text (javax.swing.text.Element elem) throws java.io.IOException, BadLocationException;
protected void writeAttributes (AttributeSet attr) throws java.io.IOException;
// Protected Instance Methods
protected void endFontTag () throws java.io.IOException;
protected boolean inFontTag ();
protected boolean isText (javax.swing.text.Element elem);
protected void startFontTag (String style) throws java.io.IOException;
protected void writeBody () throws java.io.IOException, BadLocationException;
protected void writeComponent (javax.swing.text.Element elem) throws java.io.IOException; empty
protected void writeContent (javax.swing.text.Element elem, boolean needsIndenting) throws java.io.IOException, BadLocationException;
protected void writeEndParagraph () throws java.io.IOException;
protected void writeEndTag (String endTag) throws java.io.IOException;
protected void writeHeader () throws java.io.IOException;
protected void writeHTMLTags (AttributeSet attr) throws java.io.IOException;
protected void writeImage (javax.swing.text.Element elem) throws java.io.IOException; empty
protected void writeLeaf (javax.swing.text.Element elem) throws java.io.IOException;
protected void writeNonHTMLAttributes (AttributeSet attr) throws java.io.IOException;
protected void writeStartParagraph (javax.swing.text.Element elem) throws java.io.IOException;
protected void writeStartTag (String tag) throws java.io.IOException;
protected void writeStyles () throws java.io.IOException;
}

Hierarchy: Object-->AbstractWriter-->MinimalHTMLWriter

ObjectViewJava 1.2
javax.swing.text.html

This View subclass dynamically loads, instantiates, and displays an arbitrary java.awt.Component object specified by the CLASSID attribute of an HTML <OBJECT> tag.

public class ObjectView extends ComponentView {
// Public Constructors
public ObjectView (javax.swing.text.Element elem);
// Protected Methods Overriding ComponentView
protected Component createComponent ();
}

Hierarchy: Object-->View(SwingConstants)-->ComponentView-->ObjectView

OptionJava 1.2
javax.swing.text.html

This class is used internally by HTMLDocument to represent <OPTION> tags within a <SELECT> tag.

public class Option {
// Public Constructors
public Option (AttributeSet attr);
// Property Accessor Methods (by property name)
public AttributeSet getAttributes ();
public String getLabel ();
public void setLabel (String label);
public boolean isSelected ();
public String getValue ();
// Public Methods Overriding Object
public String toString ();
// Protected Instance Methods
protected void setSelection (boolean state);
}

Passed To: HTMLWriter.writeOption()

ParagraphViewJava 1.2
javax.swing.text.html

This class displays HTML paragraph elements. It extends the javax.swing.text.ParagraphView class to add support for CSS attributes.

public class ParagraphView extends javax.swing.text.ParagraphView {
// Public Constructors
public ParagraphView (javax.swing.text.Element elem);
// Public Methods Overriding ParagraphView
public void changedUpdate (javax.swing.event.DocumentEvent e, java.awt.Shape a, ViewFactory f);
public void paint (java.awt.Graphics g, java.awt.Shape a);
// Protected Methods Overriding ParagraphView
protected SizeRequirements calculateMinorAxisRequirements (int axis, SizeRequirements r);
protected void setPropertiesFromAttributes ();
// Public Methods Overriding BoxView
public float getMaximumSpan (int axis);
public float getMinimumSpan (int axis);
public float getPreferredSpan (int axis);
// Public Methods Overriding CompositeView
public void setParent (View parent);
// Public Methods Overriding View
public AttributeSet getAttributes ();
public boolean isVisible ();
// Protected Instance Methods
protected StyleSheet getStyleSheet ();
}

Hierarchy: Object-->View(SwingConstants)-->CompositeView-->BoxView-->javax.swing.text.ParagraphView(TabExpander)-->javax.swing.text.html.ParagraphView

StyleSheetJava 1.2
javax.swing.text.htmlserializable

This class is a StyleContext subclass that represents a CSS style sheet. In Java 1.2, it is only partially implemented. However, it can parse CSS style sheets with the loadRules() method. View objects are the primary user of this class. A View object calls getViewAttributes() to obtain an appropriate AttributeSet that takes all cascading styles into account to use when displaying itself.

StyleSheet also defines two inner classes that perform certain common drawing tasks for HTML View classes. The getBoxPainter() and getListPainter() methods return immutable (possibly shared and cached) instances of these inner classes that are suitable for drawing text boxes and list items for a given AttributeSet. Various View implementations use this cache for efficiency.

public class StyleSheet extends StyleContext {
// Public Constructors
public StyleSheet ();
// Inner Classes
;
;
// Public Class Methods
public static int getIndexOfSize (float pt);
// Public Instance Methods
public void addRule (String rule);
public StyleSheet.BoxPainter getBoxPainter (AttributeSet a);
public AttributeSet getDeclaration (String decl);
public StyleSheet.ListPainter getListPainter (AttributeSet a);
public float getPointSize (String size);
public float getPointSize (int index);
public Style getRule (String selector);
public Style getRule (HTML.Tag t, javax.swing.text.Element e);
public AttributeSet getViewAttributes (View v);
public void loadRules (java.io.Reader in, java.net.URL ref) throws java.io.IOException;
public void setBaseFontSize (String size);
public void setBaseFontSize (int sz);
public java.awt.Color stringToColor (String string);
public AttributeSet translateHTMLToCSS (AttributeSet htmlAttrSet);
// Public Methods Overriding StyleContext
public AttributeSet addAttribute (AttributeSet old, Object key, Object value);
public AttributeSet addAttributes (AttributeSet old, AttributeSet attr);
public java.awt.Color getBackground (AttributeSet a);
public java.awt.Font getFont (AttributeSet a);
public java.awt.Color getForeground (AttributeSet a);
public AttributeSet removeAttribute (AttributeSet old, Object key);
public AttributeSet removeAttributes (AttributeSet old, AttributeSet attrs);
public AttributeSet removeAttributes (AttributeSet old, java.util.Enumeration names);
public void removeStyle (String nm);
// Protected Methods Overriding StyleContext
protected MutableAttributeSet createLargeAttributeSet (AttributeSet a);
protected StyleContext.SmallAttributeSet createSmallAttributeSet (AttributeSet a);
}

Hierarchy: Object-->StyleContext(AbstractDocument.AttributeContext,Serializable)-->StyleSheet

Passed To: HTMLDocument.HTMLDocument(), HTMLEditorKit.setStyleSheet()

Returned By: BlockView.getStyleSheet(), HTMLDocument.getStyleSheet(), HTMLEditorKit.getStyleSheet(), InlineView.getStyleSheet(), javax.swing.text.html.ParagraphView.getStyleSheet()

StyleSheet.BoxPainterJava 1.2
javax.swing.text.htmlserializable

This class knows how to display the CSS border and background box attributes of an HTML element. Various HTML View objects use this object to perform this drawing.

public static class StyleSheet.BoxPainter implements Serializable {
// No Constructor
// Public Instance Methods
public float getInset (int side, View v);
public void paint (java.awt.Graphics g, float x, float y, float w, float h, View v);
}

Returned By: StyleSheet.getBoxPainter()

StyleSheet.ListPainterJava 1.2
javax.swing.text.htmlserializable

This class knows how to display list bullets and numbers as specified by the various list-related CSS attributes. View objects responsible for displaying HTML lists delegate to this class to perform this drawing.

public static class StyleSheet.ListPainter implements Serializable {
// No Constructor
// Public Instance Methods
public void paint (java.awt.Graphics g, float x, float y, float w, float h, View v, int item);
}

Returned By: StyleSheet.getListPainter()



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.

This HTML Help has been published using the chm2web software.