|
|
|
@ -130,21 +130,25 @@ public class ColorAdjustPane extends JPanel implements UIObserver {
|
|
|
|
|
colorButtons.get(j).setLastButton(false); |
|
|
|
|
panel.add(colorButtons.get(j)); |
|
|
|
|
} |
|
|
|
|
if (i + maxCountOfRow > colorButtons.size() && colorButtons.size() != MAX_BUTTON) { |
|
|
|
|
panel.add(new AddColorButton()); |
|
|
|
|
this.add(panel); |
|
|
|
|
} else if (i + maxCountOfRow == colorButtons.size() && colorButtons.size() != MAX_BUTTON) { |
|
|
|
|
this.add(panel); |
|
|
|
|
this.add(new AddColorButton()); |
|
|
|
|
} else { |
|
|
|
|
this.add(panel); |
|
|
|
|
} |
|
|
|
|
addPanel(panel, i); |
|
|
|
|
} |
|
|
|
|
if (colorButtons.size() == 1) { |
|
|
|
|
colorButtons.get(0).setLastButton(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void addPanel(JPanel panel, int index) { |
|
|
|
|
if (index + maxCountOfRow > colorButtons.size() && colorButtons.size() != MAX_BUTTON) { |
|
|
|
|
panel.add(new AddColorButton()); |
|
|
|
|
this.add(panel); |
|
|
|
|
} else if (index + maxCountOfRow == colorButtons.size() && colorButtons.size() != MAX_BUTTON) { |
|
|
|
|
this.add(panel); |
|
|
|
|
this.add(new AddColorButton()); |
|
|
|
|
} else { |
|
|
|
|
this.add(panel); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void createColorButton(Color[] colors) { |
|
|
|
|
colorButtons.clear(); |
|
|
|
|
int size = Math.min(colors.length, MAX_BUTTON); |
|
|
|
|