this.cols = (int) Math.ceil((float) pal.length / (float) rows);
    public void setPalette(Color[] c)    {        this.pal = c;        this.setPreferredSize(new Dimension(            (squareSize * ((pal.length / rows) + 2)) + 1,            (squareSize * rows) + 1));    }