public class HTMLText extends RichText
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; }
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected java.awt.Color |
backgroundColor
The background color of the html document.
|
protected java.lang.String |
documentTitle
The title of the html document.
|
protected java.net.URL |
documentURL
The url of the html document.
|
protected HTMLStyle |
htmlStyle
The html style.
|
protected java.awt.Color |
linkColor
The link color of the html document.
|
protected java.awt.Color |
textColor
The text color of the html document.
|
DEFAULT_PRINT_INSETS, paragraphStyles, rtStyle, text, textStyleConstraint| コンストラクタと説明 |
|---|
HTMLText(HTMLStyle htmlStyle)
Constrcuts a html document with the specified html style.
|
HTMLText(RichText richText,
HTMLStyle htmlStyle)
Constrcuts a html document that has the same contents as the
specified rich text with the specified html style.
|
HTMLText(Text text,
HTMLStyle htmlStyle)
Constrcuts a html document with the specified text and html style.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
java.lang.String[] |
getAllAnchorNames()
Returns the names of all target anchors (references) in this html
document.
|
int |
getAnchorIndex(java.lang.String name)
Returns the index of the specified target anchor (reference) in this
html document.
|
java.awt.Color |
getBackgroundColor()
Returns the background color of this html document.
|
HTMLStyle |
getHTMLStyle()
Returns the html style of this html document.
|
java.awt.Color |
getLinkColor()
Returns the link color of this html document.
|
java.awt.Color |
getTextColor()
Returns the text color of this html document.
|
java.lang.String |
getTitle()
Returns the title of this html document.
|
java.net.URL |
getURL()
Returns the url of this html document.
|
protected void |
init(HTMLStyle htmlStyle)
Initializes this html document with the specified html style.
|
void |
setBackgroundColor(java.awt.Color color)
Sets the background color of this html document to be the specified
color.
|
TextChange |
setHTMLStyle(HTMLStyle htmlStyle)
Sets the html style of this html document to be the specified style.
|
void |
setLinkColor(java.awt.Color color)
Sets the link color of this html document to be the specified color.
|
void |
setTextColor(java.awt.Color color)
Sets the text color of this html document to be the specified color.
|
void |
setTitle(java.lang.String title)
Sets the title of this html document to be the specified string.
|
void |
setURL(java.net.URL url)
Sets the url of this html document to be the specified url.
|
clone, getAttachmentAt, getAttachmentCount, getChar, getCharacterIterator, getCharacterIterator, getCharacterIterator, getParagraphStyleAt, getParagraphStyleCount, getParagraphStyleRuns, getParagraphStyles, getParagraphStyles, getParagraphStylesPerParagraph, getRichTextStyle, getText, getTextStyleAt, getTextStyleConstraint, getTextStyleCount, getTextStyleRuns, getTextStyles, getTextStyles, isEmpty, length, modifyParagraphStyle, modifyTextStyle, nextParagraphBeginIndexOf, paragraphBeginIndexOf, paragraphEndIndexOf, paragraphStyles, paragraphStyles, print, print, print, print, replace, replace, setBaseTextStyle, setParagraphStyle, setParagraphStyles, setTextStyle, setTextStyleConstraint, setTextStyles, subtext, textStyles, textStylesprotected HTMLStyle htmlStyle
protected java.net.URL documentURL
protected java.lang.String documentTitle
protected java.awt.Color backgroundColor
protected java.awt.Color textColor
protected java.awt.Color linkColor
public HTMLText(HTMLStyle htmlStyle)
htmlStyle - the html style.public HTMLText(Text text, HTMLStyle htmlStyle)
text - the text to be laid out.htmlStyle - the html style.public HTMLText(RichText richText, HTMLStyle htmlStyle)
richText - the rich text.htmlStyle - the html style.protected void init(HTMLStyle htmlStyle)
public HTMLStyle getHTMLStyle()
public TextChange setHTMLStyle(HTMLStyle htmlStyle)
TextChange object that provides an
information of changes in this html text made by this method.public java.net.URL getURL()
public void setURL(java.net.URL url)
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
public java.awt.Color getBackgroundColor()
public void setBackgroundColor(java.awt.Color color)
public java.awt.Color getTextColor()
public void setTextColor(java.awt.Color color)
public java.awt.Color getLinkColor()
public void setLinkColor(java.awt.Color color)
public java.lang.String[] getAllAnchorNames()
public int getAnchorIndex(java.lang.String name)
name - the name of the target anchor (reference).-1
if the target anchor (reference) does not exist.