Java gridlayout中的Vaadin图像(调整大小)

Java gridlayout中的Vaadin图像(调整大小),java,eclipse,vaadin7,Java,Eclipse,Vaadin7,我用eclipse中的gridlayout(一个服务器扫雷程序)制作了一个Vaadin程序。当我在eclipse中预览时,我看到以下内容 例如,当我在firefox中调用相同的代码时,我得到 我认为这是一个调整大小或类似的问题 public void drawBoard() { this.removeAllComponents(); boardDTO = gameManager.getCurrentGame().getBoardDTO(); Integer w =

我用eclipse中的gridlayout(一个服务器扫雷程序)制作了一个Vaadin程序。当我在eclipse中预览时,我看到以下内容

例如,当我在firefox中调用相同的代码时,我得到

我认为这是一个调整大小或类似的问题

 public void drawBoard() {
    this.removeAllComponents();
    boardDTO = gameManager.getCurrentGame().getBoardDTO();
    Integer w = 30 * boardDTO.getNumOfRow() + 80;
    Integer h = boardDTO.getNumOfCol() * 30 + 150;
    String wPx = w.toString() + "px";
    String hPx = h.toString() + "px";
    this.setWidth(wPx);
    this.setHeight(hPx);
    gridLayout = new GridLayout(boardDTO.getNumOfRow(), boardDTO.getNumOfCol());
    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);

    for (int i = 0; i < boardDTO.getNumOfRow(); i++) {
        ArrayList<Cell> row = new ArrayList<Cell>();
        for (int j = 0; j < boardDTO.getNumOfCol(); j++) {
            Cell cell = new Cell(boardController, boardDTO.getCellDTO(i, j));
            cell.setVisible(true);
            row.add(cell);
            gridLayout.addComponent(cell);
            cell.addClickListener(cell);
            boardDTO.getCellDTO(i, j).addObserver(cell);
        }
        grid.add(row);
    }
    this.addComponent(gridLayout);
}

public Cell(BoardController controller, CellDTO cellDTO) {

    posX = cellDTO.getPosX();
    posY = cellDTO.getPosY();
    boardController = controller;
    setSizeUndefined();
    currentImg = BoardView.getCurrentImage(cellDTO);       


    //setStyleName();
    loadImage();
    setContent(layout);

}

@SuppressWarnings("unused")
private void loadImage() {
    layout.removeAllComponents();

    image = new Image("", new ThemeResource(currentImg));
    image.setSizeUndefined();

    Integer w=(int)getWidth();
    Integer h=(int)getHeight();
   //layout.setWidth(w+"px");
    //layout.setHeight(h+"px");

  //  image.setWidth(w.toString()+"px");
   // image.setHeight(h.toString()+"px");

    layout.addComponent(image);
    layout.setExpandRatio(image, 1.0f);
    layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
}
public void drawBoard(){
这是。removeAllComponents();
boardDTO=gameManager.getCurrentGame().getBoardDTO();
整数w=30*boardDTO.getNumOfRow()+80;
整数h=boardDTO.getNumOfCol()*30+150;
字符串wPx=w.toString()+“px”;
字符串hPx=h.toString()+“px”;
此参数为.setWidth(wPx);
这是设定高度(hPx);
gridLayout=新的gridLayout(boardDTO.getNumOfRow(),boardDTO.getNumOfCol());
gridLayout.setspace(true);
gridLayout.setMargin(true);
对于(int i=0;i

如何解决此问题的任何建议。

使用真正的浏览器进行预览。firefox的外观应该被认为是好的。您可以在eclipse中的“常规->web浏览器设置”下将默认浏览器更改为外部web浏览器