int w = getWidth() - i.left - i.right;
    public void setTile(Tile t) {        tile = t;        ImageIcon icon = null;        Insets i = getInsets();        if (tile != null && tile.getImage() != null) {            Image tileImg = tile.getImage();            int imgWidth = tileImg.getWidth(null);            int w = getWidth() - i.left - i.right;            if (imgWidth > w) {                icon = new ImageIcon(tileImg.getScaledInstance(w,                        (tileImg.getHeight(null) * w) / imgWidth,                        Image.SCALE_SMOOTH));            } else {                icon = new ImageIcon(tileImg);            }        }        setIcon(icon);    }