|
|
@ -40,6 +40,8 @@ public class ColorListPane extends JPanel implements UIObserver { |
|
|
|
private final EventListenerList colorChangeListenerList = new EventListenerList(); |
|
|
|
private final EventListenerList colorChangeListenerList = new EventListenerList(); |
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isPopulating = false; |
|
|
|
|
|
|
|
|
|
|
|
public ColorListPane() { |
|
|
|
public ColorListPane() { |
|
|
|
this(DEFAULT_COLOR_COUNT, DEFAULT_COLOR_SIZE, DEFAULT_COLOR_GAP); |
|
|
|
this(DEFAULT_COLOR_COUNT, DEFAULT_COLOR_SIZE, DEFAULT_COLOR_GAP); |
|
|
|
} |
|
|
|
} |
|
|
@ -61,6 +63,9 @@ public class ColorListPane extends JPanel implements UIObserver { |
|
|
|
colorButton.addChangeListener(new ChangeListener() { |
|
|
|
colorButton.addChangeListener(new ChangeListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
|
|
|
if (isPopulating) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
colorList.set(index, colorButton.getSelectObject()); |
|
|
|
colorList.set(index, colorButton.getSelectObject()); |
|
|
|
fireColorStateChanged(); |
|
|
|
fireColorStateChanged(); |
|
|
|
} |
|
|
|
} |
|
|
@ -88,6 +93,7 @@ public class ColorListPane extends JPanel implements UIObserver { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void populate(List<Color> colors) { |
|
|
|
public void populate(List<Color> colors) { |
|
|
|
|
|
|
|
isPopulating = true; |
|
|
|
colorList.clear(); |
|
|
|
colorList.clear(); |
|
|
|
for (int i = 0; i < colors.size(); i++) { |
|
|
|
for (int i = 0; i < colors.size(); i++) { |
|
|
|
Color color = colors.get(i); |
|
|
|
Color color = colors.get(i); |
|
|
@ -96,6 +102,7 @@ public class ColorListPane extends JPanel implements UIObserver { |
|
|
|
colorButtons.get(i).setSelectObject(color); |
|
|
|
colorButtons.get(i).setSelectObject(color); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
isPopulating = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Color> update() { |
|
|
|
public List<Color> update() { |
|
|
|