Hello,

I would like to build a Grid (to represent a chess board) with
predictable pixel sizes.

For this I need to know:
Given a single cell has pixel sizes (x, y), what's the pixel size of
the whole grid?

How can I compute this?

In this context I tried to set every cell to an exact pixel size:

for (int y = 0;y < 8;y++)
 for (int x = 0;x < 8;x++)
 {
  grd.getCellFormatter().setWidth(y,x,"50px");
  grd.getCellFormatter().setHeight(y,x,"50px");
 }

But I found out that the first inner statement (for the cell's width)
is completely ignored. Whatever I enter for the width, it does not
change anything. The heigth ist set correctly. As a consequence, I
cannot really controll the cell's pixel sizes. What's that?

The code for my component is shown below.

Thank you
Magnus

-----

package chess.client;

import com.google.gwt.user.client.*;
import com.google.gwt.user.client.ui.*;

public class Board extends AbsolutePanel
{
 private Grid grd = new Grid (8,8);

 public Board ()
 {
        super ();
        add(grd);
        init ();
 }

 private void init ()
 {
  setPixelSize (400+2,400+2);

        grd.setBorderWidth(1);
        grd.setCellPadding(0);
        grd.setCellSpacing(0);
        grd.setPixelSize(402,402);

        for (int y = 0;y < 8;y++)
                for (int x = 0;x < 8;x++)
                {
                        grd.getCellFormatter().setWidth(y,x,"111px");
                        grd.getCellFormatter().setHeight(y,x,"49px");

                }
 }
}

-- 
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