Search

Search Result

JLevel 2.0 Short Demos






JLevel version 2.0 is now  ready and will be available for download on Friday the 15th March by 9pm NZ time. It will be available on SourceForge.net and will also be downloadable from this page.  

Meanwhile  here are the preview codes to enlighten you on how to use JLevel 2.0. As mention in the previous announcements that we released regarding JLevel 2.0, it has very significant deviation from what version 1.0.0 offered before. But for the benefit of those that have used JLevel 1.0.0 Beta we have retained the variable version but has made some changes to make the variable easier to code than was previously allowed. Instead of starting a variable with $ sign and ending the variable with $ sign each variable now starts with either :
 

  • s - for styled open variable (ready to accept in-line style see demo code for details)
  • o - for open variable (ready to accept attributes see dome for details)
  • c - for closed opening variable (does not accept style nor attributes)
  • e - for end variable (ends all three opening variables above)
     
    More demos will be available soon and even more can be made available on demeand
import com.kogonuso.JLevel;

/**
 * @author Kogonuso
 * since 08/03/2013
 *
 */
public class Weather extends JLevel {

 public String DOMFormer (){
  String data ="";
  int number = 32; 
  for(int i = 1;i <.number;i++){
   data += i+" ";
  }
  
  String htmlComponents = 
    html(
    head(
     title("Welcome to JLevel"),
     attachStyle("style.css")),
    body("color:red;",
    h1("color:green;",data),br,
    comment("Kogonuso short logo image"),
    attachImage("k.gif", 300, 300),br2,
    attachApplet("applet/WriteFile.class", 200, 400),
    login("weather2.html","Username","Password","Submit"
    )
    ));
  
  
  saveAsHtml("login2", htmlComponents);
  return htmlComponents;
 }
 
}




 public static void main(String[] args) {
  Weather cot = new Weather();
  cot.processRequest();
  System.out.println("\n\n\n");
  cot.DOMFormer ();

 }




 static final int currentTemp = 70;
 static final String currentImage = "K.gif";
 static final String[] forecastDay = { "Thursday",
  "Friday",
 "Saturday" };
 static final String[] forecastImage = { "fb.png", 
  "g+.png",
 "t.png" };
 static final int[] forecastHi = { 82, 82, 73 };
 static final int[] forecastLo = { 58, 65, 48 };

 
 /*The main purpose of this demo is to demonstrate how to use JLevel 
  * 2.0 to create html table as well as how to include 
  * loop in the document former method.*/
 public void processRequest(){

  try {
   /*utput your page here. You may use following sample code. */
   String dailyForecast ="";
   for (int i = 0; i < forecastDay.length; i++) {
    dailyForecast += tr(td(nbsp,font(size$("+1"),
     t(forecastDay[i]))),
     td(center(img(width$("48"),height$("35"), src$(forecastImage[i]))
     )),
     td(center(font(size$,"+1",
     t(forecastHi[i])))),     
     td(center(font(size$,"+1",
     t(forecastLo[i])))) 
     );

   }
   String[] documnent ={
     doctype(),
     html(
     head(
     title("Sebastopol Weather Forecast"),
     attachStyle("style.css")),
     body("color:red;","the man:",//,id("red"),border("0"),
     center(
     table("color:red;",border("1"), cellpadding("0"), cellspacing$("0"), width$("70%"),
        // first row
     tr(
     td(center("",b(font(size$,"+2",t("Current Conditions"))))),
     td(center(img(width$("48"),height$,"32",src$,currentImage))),
     td( colspan$("2"),center(b(font(size$,"+2",t(currentTemp + "°")))))

     ),
       // Second row
     tr(
     td( colspan$("2"),t(""),center(b(font(size$,"+1",t("Extended Forecast"))))),
     td(center(b(font(size$,"+1",t("Hi"))))),
     td(center(b(font(size$,"+1",t("Lo")))))    

     ),

     // Daily forecast rows loop
     dailyForecast

     )//end table
     //                    tab(center(),b(),"")
     ),//end center

     br2,inputCheckbox,t("Check me")
     )//end body


     )//end html

   };//end document


   System.out.println(level(documnent));
   saveAsHtml("weather2", level(documnent));
  } finally {            
   //        out.close();
  }



 }
 
 

 

No comments: