开发者

GWT : Composite not displaying

开发者 https://www.devze.com 2022-12-29 11:12 出处:网络
I have a this code for the layout : grid = new Grid(15, 15); tiles = new Tile[15][15]; for (int i = 0; i != 15; i++)

I have a this code for the layout :

grid = new Grid(15, 15);
        tiles = new Tile[15][15];

        for (int i = 0; i != 15; i++)
        {
            for (int j = 0; j != 15; j++)
            {
                tiles[i][j] = new Tile('a');
                grid.setWidget(i, j, tiles[i][j]);
                tiles[i][j].setVisible(true);
            }
        }

        initWidget(grid);

I know it is working, because if I change the tile, by a Button, it works well.

Now my Tile class :

public class Tile extends Composite {

char character;

public Tile (Character c)
{
    this.character = c;
    buildWidget();
}

private void buildWidget()
{
    Label l = new Label(this.character+"");
    initWidget(l);
}

Why does all tiles are not displayed ?

T开发者_StackOverflowhanks for your help !


How about putting the initWidget(grid) line just after grid = new Grid(15, 15);? (it's a long shot, but based on the code you showed, I can't see anything else wrong :/)


I don't how I have solved this problem. I have just shutdowned Eclipse and it worked again !

:(

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号