Use FlexTable : FlexTable « GWT « Java






Use FlexTable

 

package com.java2s.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollListener;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.RootPanel;

public class GWTClient implements EntryPoint{
  public void onModuleLoad() {
    FlexTable flexTable = new FlexTable();
    flexTable.setWidget(0, 0, new Label("0,0"));
    flexTable.setWidget(0, 1, new Label("FlexTable"));
    flexTable.setWidget(0, 2, new Label("0,2"));
    flexTable.setWidget(1, 0, new Label("1,0"));
    flexTable.setWidget(1, 1, new Label("1,1"));
    flexTable.setWidget(1, 2, new Label("1,2"));
    flexTable.setWidget(2, 0, new Label("2,0"));
    flexTable.setWidget(2, 1, new Label("2,1"));
    flexTable.setWidget(2, 2, new Label("2,2"));
    flexTable.setWidget(3, 0, new Label("3,0 - span columns"));
    flexTable.setStyleName("panel flexTable");
    flexTable.getFlexCellFormatter().setColSpan(3, 0, 3);
    for (int i = 0; i < flexTable.getRowCount(); i++) {
        for (int j = 0; j < flexTable.getCellCount(i); j++) {
            if ((j % 2) == 0) {
                flexTable.getFlexCellFormatter()
                         .setStyleName(i, j, "tableCell-even");
            } else {
                flexTable.getFlexCellFormatter()
                         .setStyleName(i, j, "tableCell-odd");
            }
        }
    }
    RootPanel.get().add(flexTable);
  }
}

//////////////////////////

.flexTable {
  width: 150px;
  height: 150px;
  position: absolute; 
  left: 15px; 
  top: 350px;  
}

.panel {
  background-color: #C3D9FF;
  border: 1px solid #000000;
  padding: 3px;
  margin: 3px;
  font-weight: normal;  
}


           
         
  








GWT-flexTable.zip( 2 k)

Related examples in the same category

1.FlexTable with row style
2.Scroll FlexTable
3.Table Single Row Click Event
4.Table on Browser Event
5.Table Mouse Over Event
6.extends FlexTable implements TableListener
7.FlexTable with components
8.Using FlexTable to layout buttons (Ext GWT)Using FlexTable to layout buttons (Ext GWT)