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
-
HTMLText(HTMLStyle)
- Constrcuts a html document with the specified html style.
-
HTMLText(RichText, HTMLStyle)
- Constrcuts a html document that has the same contents as the
specified rich text with the specified html style.
-
HTMLText(Text, HTMLStyle)
- Constrcuts a html document with the specified text and html style.
-
getAllAnchorNames()
- Returns the names of all target anchors (references) in this html
document.
-
getAnchorIndex(String)
- Returns the index of the specified target anchor (reference) in this
html document.
-
getBackgroundColor()
- Returns the background color of this html document.
-
getHTMLStyle()
- Returns the html style of this html document.
-
getLinkColor()
- Returns the link color of this html document.
-
getTextColor()
- Returns the text color of this html document.
-
getTitle()
- Returns the title of this html document.
-
getURL()
- Returns the url of this html document.
-
setBackgroundColor(Color)
- Sets the background color of this html document to be the specified
color.
-
setHTMLStyle(HTMLStyle)
- Sets the html style of this html document to be the specified style.
-
setLinkColor(Color)
- Sets the link color of this html document to be the specified color.
-
setTextColor(Color)
- Sets the text color of this html document to be the specified color.
-
setTitle(String)
- Sets the title of this html document to be the specified string.
-
setURL(URL)
- Sets the url of this html document to be the specified url.
HTMLText
public HTMLText(HTMLStyle htmlStyle)
- Constrcuts a html document with the specified html style.
- Parameters:
- htmlStyle - the html style.
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.
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.
getHTMLStyle
public HTMLStyle getHTMLStyle()
- Returns the html style of this html document.
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.
getURL
public URL getURL()
- Returns the url of this html document.
setURL
public void setURL(URL url)
- Sets the url of this html document to be the specified url.
getTitle
public String getTitle()
- Returns the title of this html document.
setTitle
public void setTitle(String title)
- Sets the title of this html document to be the specified string.
getBackgroundColor
public Color getBackgroundColor()
- Returns the background color of this html document.
setBackgroundColor
public void setBackgroundColor(Color color)
- Sets the background color of this html document to be the specified
color.
getTextColor
public Color getTextColor()
- Returns the text color of this html document.
setTextColor
public void setTextColor(Color color)
- Sets the text color of this html document to be the specified color.
getLinkColor
public Color getLinkColor()
- Returns the link color of this html document.
setLinkColor
public void setLinkColor(Color color)
- Sets the link color of this html document to be the specified color.
getAllAnchorNames
public String[] getAllAnchorNames()
- Returns the names of all target anchors (references) in this html
document.
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