All Packages Class Hierarchy This Package Previous Next Index
Class net.strandberg.html.WebPage
java.lang.Object
|
+----net.strandberg.html.WebPage
- public class WebPage
- extends Object
- implements HTMLItem
The class WebPage is used to generate HTML WebPages. Creating an "empty" html
page by using the following Java code:
WebPage wp = new WebPage("my page");
System.out.println(wp.toHTML());
will generate the following on standard out:
<HTML>
<HEAD><TITLE>my page</TITLE></HEAD>
<BODY>
</BODY></HTML>
- Version:
- $Revision: 0.0 $
- Author:
- Mats Strandberg
-
WebPage(String)
- Constructs a web page with title as given by the parameter
-
WebPage(String, Color)
- Constructs a web page with title, header and background color as given by
the parameters
-
WebPage(String, String)
- Constructs a web page with title and header as given by the parameters
-
WebPage(String, String, Color)
- Constructs a web page with title, header and background color as given by
the parameters
-
add(HTMLItem)
- Adds an HTML item to the body of this web page.
-
add(String)
- Adds a string to the body of this web page.
-
addBodyTagParam(String)
- Adds a string to the parameters of the BODY tag of this web page.
-
addToHead(HTMLItem)
- Adds an HTML item to the head of this web page.
-
addToHead(String)
- Adds a string to the head of this web page.
-
main(String[])
- Tests the class
-
setALinkColor(int, int, int)
- Sets the color of a highlighted link on this web page.
-
setBgColor(Color)
- Sets the background color of this web page.
-
setBgColor(int, int, int)
- Sets the background color of this web page.
-
setBgColorLightGray()
- Sets the background color of this web page to light gray.
-
setBgColorWhite()
- Sets the background color of this web page to white.
-
setLinkColor(int, int, int)
- Sets the color of (unvisited) links on this web page.
-
setVLinkColor(int, int, int)
- Sets the color of visited links on this web page.
-
toHTML()
-
Returns HTML code presenting this web page.
WebPage
public WebPage(String title)
- Constructs a web page with title as given by the parameter
- Parameters:
- title - the title of the page (to be generated between <TITLE> and
</TITLE> tags.
WebPage
public WebPage(String title,
String header)
- Constructs a web page with title and header as given by the parameters
- Parameters:
- title - the title of the page (to be generated between <TITLE> and
</TITLE> tags.
- header - the page header (to be generated on top of page between <H1>
and </H1>
WebPage
public WebPage(String title,
String header,
Color backGroundColor)
- Constructs a web page with title, header and background color as given by
the parameters
- Parameters:
- title - the title of the page (to be generated between <TITLE> and
</TITLE> tags.
- header - the page header (to be generated on top of page between <H1>
and </H1>
- backGroundColor - the background color of this web page
WebPage
public WebPage(String title,
Color backGroundColor)
- Constructs a web page with title, header and background color as given by
the parameters
- Parameters:
- title - the title of the page (to be generated between <TITLE> and
</TITLE> tags.
- backGroundColor - the background color of this web page
setBgColorLightGray
public void setBgColorLightGray()
- Sets the background color of this web page to light gray.
setBgColorWhite
public void setBgColorWhite()
- Sets the background color of this web page to white.
setBgColor
public void setBgColor(Color c)
- Sets the background color of this web page.
- Parameters:
- c - the color to set as background color
setBgColor
public void setBgColor(int r,
int g,
int b)
- Sets the background color of this web page.
- Parameters:
- r - the red component, a value between 0 and 255
- g - the green component, a value between 0 and 255
- b - the blue component, a value between 0 and 255
setLinkColor
public void setLinkColor(int r,
int g,
int b)
- Sets the color of (unvisited) links on this web page.
This corresponds to the
LINK
param of the BODY
tag.
- Parameters:
- r - the red component, a value between 0 and 255
- g - the green component, a value between 0 and 255
- b - the blue component, a value between 0 and 255
setVLinkColor
public void setVLinkColor(int r,
int g,
int b)
- Sets the color of visited links on this web page.
This corresponds to the
VLINK
param of the BODY
tag.
- Parameters:
- r - the red component, a value between 0 and 255
- g - the green component, a value between 0 and 255
- b - the blue component, a value between 0 and 255
setALinkColor
public void setALinkColor(int r,
int g,
int b)
- Sets the color of a highlighted link on this web page.
Links on a web page gets highlighted when clicked upon.
This corresponds to the
ALINK
param of the BODY
tag.
- Parameters:
- r - the red component, a value between 0 and 255
- g - the green component, a value between 0 and 255
- b - the blue component, a value between 0 and 255
addToHead
public void addToHead(HTMLItem item)
- Adds an HTML item to the head of this web page.
- Parameters:
- item - the HTML item to add to this page
addToHead
public void addToHead(String s)
- Adds a string to the head of this web page.
- Parameters:
- s - the string to add to the head of this web page
addBodyTagParam
public void addBodyTagParam(String s)
- Adds a string to the parameters of the BODY tag of this web page.
- Parameters:
- s - the string to add as parameter
add
public void add(HTMLItem item)
- Adds an HTML item to the body of this web page.
- Parameters:
- item - the HTML item to add to this page
add
public void add(String s)
- Adds a string to the body of this web page.
- Parameters:
- s - the string to add to this page
toHTML
public String toHTML()
- Returns HTML code presenting this web page.
- Returns:
- HTML code presenting this web page with all items that's
been added prior to this call
main
public static void main(String args[])
- Tests the class
All Packages Class Hierarchy This Package Previous Next Index