java.lang.Object | +--com.mkaz.htmllib
com.mkaz.htmllib is a java library which provides shortcut methods to ease the development of html documents (code). This can be compared to CGI.pm for Perl. Many of the commands and shortcuts available in CGI.pm are (or will be) available here.
Example Usage:
htmllib html = new htmllib(); // create a link out.println(html.link("web blazonry","http://blazonry.com/"));
Constructor Summary | |
htmllib()
Main Constructor. |
Method Summary | |
java.lang.String |
b(java.lang.String str)
Creates a bold piece of text |
java.lang.String |
endftable()
Creates an end table tag for fancy table |
java.lang.String |
endtable()
Creates an end table tag. |
java.lang.String |
form(java.lang.String action,
java.lang.String method)
Creates a form tag with action url and method |
java.lang.String |
ftable(java.lang.String color1,
java.lang.String color2,
java.lang.String width)
Creates a fancy table tag with color1 border and color2 background (padding=4 spacing=0) |
java.lang.String |
h1(java.lang.String str)
Creates an HTML H1 |
java.lang.String |
h2(java.lang.String str)
Creates an HTML H2 |
java.lang.String |
h3(java.lang.String str)
Creates an HTML H3 |
java.lang.String |
h4(java.lang.String str)
Creates an HTML H4 |
java.lang.String |
h5(java.lang.String str)
Creates an HTML H5 |
java.lang.String |
h6(java.lang.String str)
Creates an HTML H6 |
java.lang.String |
header(java.lang.String title)
Creates a complete HTML header with DOCTYPE 4.0T, HTML, HEAD, TITLE and BODY tags. |
java.lang.String |
header(java.lang.String title,
java.lang.String bgcolor)
Creates a complete HTML header with DOCTYPE 4.0T, HTML, HEAD, TITLE and BODY tags. |
java.lang.String |
hfrow(java.lang.String[] col,
java.lang.String bgcolor)
Creates a table header row from an array |
java.lang.String |
hfrow(java.lang.String col1,
java.lang.String col2,
java.lang.String bgcolor)
Creates a two col table header row |
java.lang.String |
hfrow(java.lang.String col1,
java.lang.String col2,
java.lang.String col3,
java.lang.String bgcolor)
Creates a three col table header row. |
java.lang.String |
hfrow(java.lang.String col1,
java.lang.String col2,
java.lang.String col3,
java.lang.String col4,
java.lang.String bgcolor)
Creates a four col table header row |
java.lang.String |
hidden(java.lang.String name,
java.lang.String value)
Creates a hidden form element with name, value |
java.lang.String |
hrow(java.lang.String[] col)
Creates a table header row from an array |
java.lang.String |
hrow(java.lang.String col1,
java.lang.String col2)
Creates a two col table header row |
java.lang.String |
hrow(java.lang.String col1,
java.lang.String col2,
java.lang.String col3)
Creates a three col table header row. |
java.lang.String |
hrow(java.lang.String col1,
java.lang.String col2,
java.lang.String col3,
java.lang.String col4)
Creates a four col table header row |
java.lang.String |
i(java.lang.String str)
Creates an italic piece of text |
java.lang.String |
img(java.lang.String image,
int width,
int height,
java.lang.String alt)
Creates an image tag with width, height, and alternate text |
java.lang.String |
img(java.lang.String image,
java.lang.String alt)
Creates an image tag |
java.lang.String |
link(java.lang.String desc,
java.lang.String url)
Creates an HTML A HREF link. |
java.lang.String |
password(java.lang.String name,
int size,
int maxlength)
Creates a password form element with name, size, maxlength |
java.lang.String |
row(java.lang.String[] col)
Creates a table row from an array |
java.lang.String |
row(java.lang.String col1,
java.lang.String col2)
Creates a two col table row |
java.lang.String |
row(java.lang.String col1,
java.lang.String col2,
java.lang.String col3)
Creates a three col table row. |
java.lang.String |
row(java.lang.String col1,
java.lang.String col2,
java.lang.String col3,
java.lang.String col4)
Creates a four col table row |
java.lang.String |
selectfield(java.lang.String fieldname,
java.util.Hashtable options)
Creates a select field with options |
java.lang.String |
submit(java.lang.String value)
Creates a submit button form element with value |
java.lang.String |
table()
Create a "blank" table tag. |
java.lang.String |
table(int padding,
int spacing,
int border)
Creates a table tag with padding, spacing and border |
java.lang.String |
table(int padding,
int spacing,
int border,
java.lang.String width)
Creates a table tag with padding, spacing, border and width |
java.lang.String |
text(java.lang.String name,
java.lang.String value,
int size,
int maxlength)
Creates a text form element with name, value, size, maxlength |
java.lang.String |
textarea(java.lang.String name,
java.lang.String value,
int rows,
int cols)
Creates a textarea form element with name, value, rows, cols (wrap on) |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public htmllib()
Example: htmllib html = new htmllib();
Method Detail |
public java.lang.String header(java.lang.String title)
title
- title of the HTML page (string)public java.lang.String header(java.lang.String title, java.lang.String bgcolor)
title
- title of the HTML page (string)bgcolor
- HTML color hex (with #), or color name for backgroundpublic java.lang.String h1(java.lang.String str)
string
- text to be H1public java.lang.String h2(java.lang.String str)
string
- text to be H2public java.lang.String h3(java.lang.String str)
string
- text to be H3public java.lang.String h4(java.lang.String str)
string
- text to be H4public java.lang.String h5(java.lang.String str)
string
- text to be H5public java.lang.String h6(java.lang.String str)
string
- text to be H6public java.lang.String b(java.lang.String str)
string
- text to be boldedpublic java.lang.String i(java.lang.String str)
string
- text to be italicpublic java.lang.String link(java.lang.String desc, java.lang.String url)
desc
- the description of the link, ie. the (blue) part that shows up
on screen.url
- the URL to set the link topublic java.lang.String table()
public java.lang.String endtable()
public java.lang.String table(int padding, int spacing, int border)
padding
- int CELLPADDING for tablespacing
- int CELLSPACING for tableborder
- int BORDER width for tablepublic java.lang.String table(int padding, int spacing, int border, java.lang.String width)
padding
- int CELLPADDING for tablespacing
- int CELLSPACING for tableborder
- int BORDER width for tablewidth
- string width of table (% or px)public java.lang.String hrow(java.lang.String col1, java.lang.String col2)
col1
- string contents for col1col2
- string contents for col2public java.lang.String hrow(java.lang.String col1, java.lang.String col2, java.lang.String col3)
col1
- string contents for col1col2
- string contents for col2col3
- string contents for col3public java.lang.String hrow(java.lang.String col1, java.lang.String col2, java.lang.String col3, java.lang.String col4)
col1
- string contents for col1col2
- string contents for col2col3
- string contents for col3col4
- string contents for col4public java.lang.String hrow(java.lang.String[] col)
col
- string array of columnspublic java.lang.String row(java.lang.String col1, java.lang.String col2)
col1
- string contents for col1col2
- string contents for col2public java.lang.String row(java.lang.String col1, java.lang.String col2, java.lang.String col3)
col1
- string contents for col1col2
- string contents for col2col3
- string contents for col3public java.lang.String row(java.lang.String col1, java.lang.String col2, java.lang.String col3, java.lang.String col4)
col1
- string contents for col1col2
- string contents for col2col3
- string contents for col3col4
- string contents for col4public java.lang.String row(java.lang.String[] col)
col
- string array of columnspublic java.lang.String endftable()
public java.lang.String ftable(java.lang.String color1, java.lang.String color2, java.lang.String width)
color1
- String BORDER color for fancy tablecolor2
- String BACKGROUND for fancy tablewidth
- String WIDTH of the fancy tablepublic java.lang.String hfrow(java.lang.String col1, java.lang.String col2, java.lang.String bgcolor)
col1
- string contents for col1col2
- string contents for col2bgcolor
- string background colorpublic java.lang.String hfrow(java.lang.String col1, java.lang.String col2, java.lang.String col3, java.lang.String bgcolor)
col1
- string contents for col1col2
- string contents for col2col3
- string contents for col3bgcolor
- string background colorpublic java.lang.String hfrow(java.lang.String col1, java.lang.String col2, java.lang.String col3, java.lang.String col4, java.lang.String bgcolor)
col1
- string contents for col1col2
- string contents for col2col3
- string contents for col3col4
- string contents for col4bgcolor
- string background colorpublic java.lang.String hfrow(java.lang.String[] col, java.lang.String bgcolor)
col
- string array of columnsbgcolor
- string background colorpublic java.lang.String img(java.lang.String image, java.lang.String alt)
image
- string link to imagealt
- string alternate textpublic java.lang.String img(java.lang.String image, int width, int height, java.lang.String alt)
image
- string link to imagewidth
- int width of imageheight
- int height of imagealt
- string alternate textpublic java.lang.String form(java.lang.String action, java.lang.String method)
action
- url to submit the form to, action field in formmethod
- GET or POSTpublic java.lang.String hidden(java.lang.String name, java.lang.String value)
name
- String hidden field namevalue
- String hidden field valuepublic java.lang.String submit(java.lang.String value)
value
- string text displayed on the buttonpublic java.lang.String text(java.lang.String name, java.lang.String value, int size, int maxlength)
name
- string text field namevalue
- string text field default valuesize
- int text field widthmaxlength
- int text field maximum lengthpublic java.lang.String password(java.lang.String name, int size, int maxlength)
name
- string text field namesize
- int text field widthmaxlength
- int text field maximum lengthpublic java.lang.String textarea(java.lang.String name, java.lang.String value, int rows, int cols)
name
- String textarea field namevalue
- String textarea field default valuerows
- int number of rows in textareacols
- int number of columns in textareapublic java.lang.String selectfield(java.lang.String fieldname, java.util.Hashtable options)
fieldname
- name of the select fieldoptions
- Hashtable of options with the option value set to the hashkey, and the display value set to the hashvalue