The GridLayoutFormPanel class represents a grid layout of form elements. You use this layout for an HTML form where you specify the number of columns for the grid.
The following example creates a GridLayoutFormPanel object with two columns:
// Create a text form input element for the system. LabelFormElement sysPrompt = new LabelFormElement("System:"); TextFormInput system = new TextFormInput("System"); // Create a text form input element for the userId. LabelFormElement userPrompt = new LabelFormElement("User:"); TextFormInput user = new TextFormInput("User"); // Create a password form input element for the password. LabelFormElement passwordPrompt = new LabelFormElement("Password:"); PasswordFormInput password = new PasswordFormInput("Password"); // Create the GridLayoutFormPanel object with two columns and add the form elements. GridLayoutFormPanel panel = new GridLayoutFormPanel(2); panel.addElement(sysPrompt); panel.addElement(system); panel.addElement(userPrompt); panel.addElement(user); panel.addElement(passwordPrompt); panel.addElement(password); // Create the submit button to the form. SubmitFormInput logonButton = new SubmitFormInput("logon", "Logon"); // Create HTMLForm object and add the panel to it. HTMLForm form = new HTMLForm(servletURI); form.addElement(panel); form.addElement(logonButton);
This example produces the following HTML code:
<form action=servletURI method="get"> <table border="0"> <tr> <td>System:</td> <td><input type="text" name="System" /></td> </tr> <tr> <td>User:</td> <td><input type="text" name="User" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="Password" /></td> </tr> </table> <input type="submit" name="logon" value="Logon" /> </form>