Hi,

I need a Grid with the following simple requirements:

- 10 * 10 cells

- inner 8*8 cells (form a chess board):
  rows 1-8; cols 1-8: pixel size 50 * 50

- outer cells (form the annotations, e. g. "A", "1"):
  rows 0 and 9: pixel height: 10
  cols 0 and 9pixel width: 10

The total pixel size of the grid must therefore be 8*50 + 2*10 = 420
(width and height).

I cannot get this realized with a grid. Although I set the pixel sizes
for every cell, it's never correct. The annotation cells are always of
the same size as the other cells.

Below is my code.

What can I do?

Thanks
Magnus



private void init ()
 {
  setPixelSize (420,420);

  grd.setPixelSize (420,420);
  grd.setBorderWidth (0);
  grd.setCellPadding (0);
  grd.setCellSpacing (0);

  CellFormatter cf = grd.getCellFormatter ();

  // set the inner cells

  for (int y = 1;y < 9;y++)
   for (int x = 1;x < 9;x++)
   {
    String s;

    if (((x + y) & 1) != 0)
     s = "blackCell";
    else
     s = "whiteCell";

    cf.addStyleName (y,x,s); // just the cells color, no sizes here
    cf.setWidth (y,x,"50px");
    cf.setHeight (y,x,"50px");
   }

  // set the outer cells

  for (int x = 0;x < 10;x++)
  {
   cf.setHeight (x,0,"10px");
   cf.setHeight (x,9,"10px");
  }

  for (int y = 0;y < 10;y++)
  {
   cf.setWidth (0,y,"10px");
   cf.setWidth (9,y,"10px");
  }
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to