All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.graphics.html.HTMLText

java.lang.Object
   |
   +----jp.kyasu.graphics.RichText
           |
           +----jp.kyasu.graphics.html.HTMLText

public class HTMLText
extends RichText
The HTMLText class implements the editable HTML document. This class is a subclass of the RichText class and it can act as a model for the TextEditView and TextEditController.

A HTMLText object is created from a HTML document ('text/html') by a HTMLReader object.

For example:

    URL url = null;
    try {
        url = new URL("http://ring.aist.go.jp/openlab/kyasu/");
    }
    catch (MalformedURLException e) { return; }
    HTMLReader htmlReader = new HTMLReader(new HTMLStyle());
    HTMLText htmlText = null;
    try {
        htmlText = htmlReader.readFrom(url);
    }
    catch (IOException e) { return; }
 

A HTMLText is saved as a HTML document ('text/html') by a HTMLWriter object.

For example:

    HTMLWriter htmlWriter = new HTMLWriter(htmlText);
    try {
        htmlWriter.writeTo(new File("index.html"));
    }
    catch (IOException e) { return; }
 

Version:
14 Jun 1998
Author:
Kazuki YASUMATSU
See Also:
RichText, HTMLStyle, HTMLReader, HTMLWriter, TextEditView, TextEditController

Constructor Index

 o HTMLText(HTMLStyle)
Constrcuts a html document with the specified html style.
 o HTMLText(RichText, HTMLStyle)
Constrcuts a html document that has the same contents as the specified rich text with the specified html style.
 o HTMLText(Text, HTMLStyle)
Constrcuts a html document with the specified text and html style.

Method Index

 o getAllAnchorNames()
Returns the names of all target anchors (references) in this html document.
 o getAnchorIndex(String)
Returns the index of the specified target anchor (reference) in this html document.
 o getBackgroundColor()
Returns the background color of this html document.
 o getHTMLStyle()
Returns the html style of this html document.
 o getLinkColor()
Returns the link color of this html document.
 o getTextColor()
Returns the text color of this html document.
 o getTitle()
Returns the title of this html document.
 o getURL()
Returns the url of this html document.
 o setBackgroundColor(Color)
Sets the background color of this html document to be the specified color.
 o setHTMLStyle(HTMLStyle)
Sets the html style of this html document to be the specified style.
 o setLinkColor(Color)
Sets the link color of this html document to be the specified color.
 o setTextColor(Color)
Sets the text color of this html document to be the specified color.
 o setTitle(String)
Sets the title of this html document to be the specified string.
 o setURL(URL)
Sets the url of this html document to be the specified url.

Constructors

 o HTMLText
 public HTMLText(HTMLStyle htmlStyle)
Constrcuts a html document with the specified html style.

Parameters:
htmlStyle - the html style.
 o HTMLText
 public HTMLText(Text text,
                 HTMLStyle htmlStyle)
Constrcuts a html document with the specified text and html style.

Parameters:
text - the text to be laid out.
htmlStyle - the html style.
 o HTMLText
 public HTMLText(RichText richText,
                 HTMLStyle htmlStyle)
Constrcuts a html document that has the same contents as the specified rich text with the specified html style. The style of the specified rich text should equal to the rich text from the specified html style.

Parameters:
richText - the rich text.
htmlStyle - the html style.

Methods

 o getHTMLStyle
 public HTMLStyle getHTMLStyle()
Returns the html style of this html document.

 o setHTMLStyle
 public TextChange setHTMLStyle(HTMLStyle htmlStyle)
Sets the html style of this html document to be the specified style.

Returns:
the TextChange object that provides an information of changes in this html text made by this method.
 o getURL
 public URL getURL()
Returns the url of this html document.

 o setURL
 public void setURL(URL url)
Sets the url of this html document to be the specified url.

 o getTitle
 public String getTitle()
Returns the title of this html document.

 o setTitle
 public void setTitle(String title)
Sets the title of this html document to be the specified string.

 o getBackgroundColor
 public Color getBackgroundColor()
Returns the background color of this html document.

 o setBackgroundColor
 public void setBackgroundColor(Color color)
Sets the background color of this html document to be the specified color.

 o getTextColor
 public Color getTextColor()
Returns the text color of this html document.

 o setTextColor
 public void setTextColor(Color color)
Sets the text color of this html document to be the specified color.

 o getLinkColor
 public Color getLinkColor()
Returns the link color of this html document.

 o setLinkColor
 public void setLinkColor(Color color)
Sets the link color of this html document to be the specified color.

 o getAllAnchorNames
 public String[] getAllAnchorNames()
Returns the names of all target anchors (references) in this html document.

 o getAnchorIndex
 public int getAnchorIndex(String name)
Returns the index of the specified target anchor (reference) in this html document.

Parameters:
name - the name of the target anchor (reference).
Returns:
the index of the target anchor (reference); or -1 if the target anchor (reference) does not exist.

All Packages  Class Hierarchy  This Package  Previous  Next  Index