/***************************************** * Hlib.java * From http://home.att.net/~gobruen * * Called by the HTMLGen.java * takes the JText input from the main program * and generates HTML content and returns it * to the main where is it made into a file * ******************************************/ public class Hlib { public static String makePage(String title, String meta, String bgcolor, String textcolor, String textfont, String genLink, String genLinkN, String img, String paragArr[]){ /******************************************************** * Tag Library * each String tag is decribe in the * comment next to it * ********************************************************/ String fileContent; //The end product file String HHTMLtagOp =""; //start the html page String HheadTit1 = ""; //head and title open tags String HheadTit2 = ""; //close head and open String HbodytagOp = ""; //generic tag close String Hopentag = "<"; //generic tag open String HmetaOp = ""; //font tag open String HbodytagCl = ""; //close body tag String HHTMLtagCl = ""; //end html file String HAHREFOp = ""; //close tag with double quote String HAHREFCtag = ""; //close link String HBR = "
"; //line break String H2o = "

"; //page heading String H2c = "

"; //close page heading /************************* * * Secton creates content * *************************/ if(bgcolor.equals("")){ bgcolor="WHITE"; } if(textcolor.equals("")){ textcolor="BLACK"; } fileContent = HHTMLtagOp + HheadTit1 + title+ HheadTit2 + HbodytagOp + bgcolor + HbodyTextC + textcolor + Hclosetag + HmetaOp + meta + Hclosetag + HfontOp + textfont + Hclosetag + H2o + title + H2c + retImage(img) + getAllParags(paragArr) + HBR + makeAlink(genLink, genLinkN) + HfontCl + HbodytagCl + HHTMLtagCl; return fileContent; }//end makePage() public static String retImage(String img){ String HimgOp = ""; //image tag close String Hclosetag = ">"; //generic tag close if(!img.equals("")){ img = HimgOp + "images/" + img + Hclosetag + HimgCl; } return img; } /***************************** * * Breaks up the paragraphs * and puts them in

tags * ******************************/ public static String getAllParags(String paragArr[]){ String pContent = ""; String Po = "

"; String Pc = "

"; /* * Go through paragraph array and make * individual sections for paragraphs * that were entered */ for(int i =0; i < paragArr.length; i++){ if(paragArr[i]!=null){ pContent = pContent + Po + paragArr[i] + Pc + "\n"; } } return pContent; }//end getAllParags /*************************************************** * * Generates links * Combine the tags, link and link * name into one string and return it ***************************************************/ public static String makeAlink(String aLink, String aName){ return ""+aName+""; }//end makeAlink }//end Hlib.java