Java/GWT/HorizontalPanel
Версия от 18:01, 31 мая 2010; (обсуждение)
Layout with Horizontal Panel
package com.jexp.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);
}
}