ImagePanel panels[] = { getPalettePanel(), getColorChooserPalettePanel() };
for (ImagePanel imgPanel : panels) {
int width = imgPanel.getWidth();
int height = imgPanel.getHeight();
if (width >= 16 && height >= 4) {
SimpleImage img = new RGBPaletteRenderer().renderHorizPalette(getCurrLayer().getPalette(), width, height);
imgPanel.setImage(img);
}
imgPanel.getParent().validate();
imgPanel.repaint();
}