this.selectedColor = c; repaint();
if (c >= 0 && pal != null && c < pal.length) { this.selectedColor = c; repaint(); }
    public void setSelectedColorIndex(int c)    {        this.selectedColor = c;        repaint();    }