ContentPanel with buttons (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.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class Hello implements EntryPoint {
public void onModuleLoad() {
SelectionListener<ButtonEvent> l = new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Info.display("Click", ce.getButton().getText() + " clicked");
}
};
int i = 1;
ContentPanel cp = new ContentPanel();
for (HorizontalAlignment align : HorizontalAlignment.values()) {
cp.setHeading("ButtonAligning Example: " + align.name().toLowerCase());
for (int j = 0; j < 3; i++, j++) {
cp.addButton(new Button("Button " + i, l));
}
cp.setButtonAlign(align);
cp.setFrame(true);
cp.setSize(500, 150);
cp.setLayout(new FitLayout());
LayoutContainer c = new LayoutContainer();
c.setStyleAttribute("backgroundColor", "white");
c.setBorders(true);
cp.add(c);
}
RootPanel.get().add(cp);
}
}
Ext-GWT.zip( 4,297 k)Related examples in the same category