Merge pull request #129 from kruland2607/fixdecaldropdown

Fix for issue #116
This commit is contained in:
kruland2607 2013-09-03 18:54:24 -07:00
commit 5239123f6c
2 changed files with 8 additions and 2 deletions

View File

@ -46,7 +46,7 @@ public class DecalModel extends AbstractListModel implements ComboBoxModel {
@Override
public Object getElementAt(int index) {
if (index == 0) {
if (index <= 0) {
return NONE_SELECTED;
}
if (index == getSize() - 1) {
@ -93,4 +93,8 @@ public class DecalModel extends AbstractListModel implements ComboBoxModel {
}
}
public void refresh() {
decals = document.getDecalList().toArray(new DecalImage[0]);
fireContentsChanged(this, 0, decals.length);
}
}

View File

@ -145,7 +145,8 @@ public class AppearancePanel extends JPanel {
final JButton colorButton = new JButton(new ColorIcon(ab.getPaint()));
final JComboBox textureDropDown = new JComboBox(new DecalModel(this, document, ab));
final DecalModel decalModel = new DecalModel(this, document, ab);
final JComboBox textureDropDown = new JComboBox(decalModel);
ab.addChangeListener(new StateChangeListener() {
@Override
@ -153,6 +154,7 @@ public class AppearancePanel extends JPanel {
figureColorButton.setIcon(new ColorIcon(c.getColor()));
colorButton.setIcon(new ColorIcon(ab.getPaint()));
c.setAppearance(ab.getAppearance());
decalModel.refresh();
}
});