Using FormPanel to layout fields (Ext GWT) : Form « GWT « Java






Using FormPanel to layout fields (Ext GWT)

Using FormPanel to layout fields (Ext GWT)
 


/*
 * Ext GWT - Ext for GWT
 * Copyright(c) 2007-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
 
package com.google.gwt.sample.hello.client;

import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.HtmlEditor;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class Hello implements EntryPoint {

  public void onModuleLoad() {
    final Window w = new Window();
    w.setPlain(true);
    w.setSize(500, 300);
    w.setHeading("Resize Me");
    w.setLayout(new FitLayout());

    FormPanel panel = new FormPanel();
    panel.setBorders(false);
    panel.setBodyBorder(false);
    panel.setLabelWidth(55);
    panel.setPadding(5);
    panel.setHeaderVisible(false);

    TextField<String> field = new TextField<String>();
    field.setFieldLabel("Sent To");
    panel.add(field, new FormData("100%"));

    field = new TextField<String>();
    field.setFieldLabel("Subject");
    panel.add(field, new FormData("100%"));

    HtmlEditor html = new HtmlEditor();
    html.setHideLabel(true);
    panel.add(html, new FormData("100% -53"));

    w.addButton(new Button("Send"));
    w.addButton(new Button("Cancel"));
    w.add(panel);

    Button b = new Button("Open", new SelectionListener<ButtonEvent>() {

      @Override
      public void componentSelected(ButtonEvent ce) {
        w.show();
      }

    });
    RootPanel.get().add(b);

  }
}

   
  








Ext-GWT.zip( 4,297 k)

Related examples in the same category

1.Adding border line to a form (Smart GWT)Adding border line to a form (Smart GWT)
2.Forms are split for layout (Smart GWT)Forms are split for layout (Smart GWT)
3.Form validation for splitted form (Smart GWT)
4.Drag resize the form from the right edge (Smart GWT)Drag resize the form from the right edge (Smart GWT)
5.Form data validation (Smart GWT)Form data validation (Smart GWT)
6.Form data binding (Smart GWT)Form data binding (Smart GWT)
7.Form Filling Layout Sample (Smart GWT)Form Filling Layout Sample (Smart GWT)
8.Set form width (Smart GWT)Set form width (Smart GWT)
9.Change title Orientation (Smart GWT)Change title Orientation (Smart GWT)
10.Form controls Show/Hide Sample (Smart GWT)Form controls Show/Hide Sample (Smart GWT)
11.Form control Enable/Disable Sample (Smart GWT)Form control Enable/Disable Sample (Smart GWT)
12.Form Dependent Selects Sample (Smart GWT)Form Dependent Selects Sample (Smart GWT)
13.Add fields to a form with setFields (Smart GWT)Add fields to a form with setFields (Smart GWT)
14.Form Data bound Dependent Selects Sample (Smart GWT)Form Data bound Dependent Selects Sample (Smart GWT)
15.Expand or collapse the text box (Smart GWT)Expand or collapse the text box (Smart GWT)
16.Link the table and form fields (Smart GWT)Link the table and form fields (Smart GWT)
17.Two-column form (Ext GWT)Two-column form (Ext GWT)
18.Collapsible FieldSet (Ext GWT)Collapsible FieldSet (Ext GWT)
19.CheckBox toggling FieldSet (Ext GWT)CheckBox toggling FieldSet (Ext GWT)
20.Support for standard Panel features such as framing, buttons and toolbars (Ext GWT)Support for standard Panel features such as framing, buttons and toolbars (Ext GWT)
21.ContentPanel with buttons (Ext GWT)ContentPanel with buttons (Ext GWT)
22.Make ContentPanel Collapsible (Ext GWT)Make ContentPanel Collapsible (Ext GWT)
23.Set busy status for Status control (Ext GWT)Set busy status for Status control (Ext GWT)