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

Constructor Index

 o WebPage(String)
Constructs a web page with title as given by the parameter
 o WebPage(String, Color)
Constructs a web page with title, header and background color as given by the parameters
 o WebPage(String, String)
Constructs a web page with title and header as given by the parameters
 o WebPage(String, String, Color)
Constructs a web page with title, header and background color as given by the parameters

Method Index

 o add(HTMLItem)
Adds an HTML item to the body of this web page.
 o add(String)
Adds a string to the body of this web page.
 o addBodyTagParam(String)
Adds a string to the parameters of the BODY tag of this web page.
 o addToHead(HTMLItem)
Adds an HTML item to the head of this web page.
 o addToHead(String)
Adds a string to the head of this web page.
 o main(String[])
Tests the class
 o setALinkColor(int, int, int)
Sets the color of a highlighted link on this web page.
 o setBgColor(Color)
Sets the background color of this web page.
 o setBgColor(int, int, int)
Sets the background color of this web page.
 o setBgColorLightGray()
Sets the background color of this web page to light gray.
 o setBgColorWhite()
Sets the background color of this web page to white.
 o setLinkColor(int, int, int)
Sets the color of (unvisited) links on this web page.
 o setVLinkColor(int, int, int)
Sets the color of visited links on this web page.
 o toHTML()
Returns HTML code presenting this web page.

Constructors

 o 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.
 o 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>
 o 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
 o 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

Methods

 o setBgColorLightGray
 public void setBgColorLightGray()
Sets the background color of this web page to light gray.

 o setBgColorWhite
 public void setBgColorWhite()
Sets the background color of this web page to white.

 o setBgColor
 public void setBgColor(Color c)
Sets the background color of this web page.

Parameters:
c - the color to set as background color
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o main
 public static void main(String args[])
Tests the class


All Packages  Class Hierarchy  This Package  Previous  Next  Index