package e4s.tutorial; import e4s.html.*; import e4s.html.style.*; import e4s.servlet.*; import e4s.translate.*; /** * Create BUTTONS that reference to a function within your code, * assigning buttons with E4JavaScript functionality or placing images * on buttons. * * {@tutorial Example_Button} * * @see e4s.html.BUTTON */ public class Example_BUTTON extends E4ModuleImplementation { public static E4Method start = null; public static E4Method badFunction = null; public static E4Method goodFunction = null; public void start( HTML html ) { E4EventHandlerBUTTON evt = new E4EventHandlerBUTTON(E4EventHandlerBUTTON._EVENT_ONCLICK); evt.appendln("function " + evt.getName() + "()"); evt.appendln("{"); evt.appendln(" alert('Hello Button');"); evt.appendln("}"); BUTTON b1 = html.BUTTON(new E4LabelApp("Hello World Button"),evt); html.P(); BUTTON b2 = html.BUTTON(badFunction,getServlet()); b2.B().STRIKE().print("Do not click here!"); html.P(); BUTTON b3 = html.BUTTON(goodFunction,getServlet()); b3.IMG("images/tutorial/Example_MultiState/orange.gif"); b3.setSTYLE((CLASS_Name)null); } public void badFunction( HTML html ) { html.Message(E4Message.ERROR,"You clicked!"); html.P(); start(html); } public void goodFunction( HTML html ) { html.Message(E4Message.INFO,"You clicked!"); html.P(); start(html); } }