Layout with Horizontal Panel : HorizontalPanel « GWT « Java






Layout with Horizontal Panel



package com.java2s.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextBox;

public class GWTClient implements EntryPoint {

  public void onModuleLoad() {
    Button b = new Button("Click me", new ClickListener() {
      public void onClick(Widget sender) {
        Window.alert("Hello, AJAX");
      }
    });
    
    TextBox textBox = new TextBox();

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(b);
    hp.add(textBox);
    hp.setCellHorizontalAlignment(b, HorizontalPanel.ALIGN_LEFT);
    hp.setCellHorizontalAlignment(textBox, HorizontalPanel.ALIGN_RIGHT);

    hp.setWidth("100%");

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


           
       








GWT-horizontalPanel.zip( 2 k)

Related examples in the same category