Refresh the texture drop down contents when one edits a single copy of a

decal
This commit is contained in:
kruland2607 2013-09-03 14:53:51 -05:00
parent 265fdfe05e
commit 4c3a16f02b
2 changed files with 7 additions and 1 deletions

View File

@ -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
@ -274,6 +275,7 @@ public class AppearancePanel extends JPanel {
try {
DecalImage newImage = editDecalHelper.editDecal(SwingUtilities.getWindowAncestor(AppearancePanel.this), document, c, ab.getImage());
ab.setImage(newImage);
decalModel.refresh();
} catch (EditDecalHelperException ex) {
JOptionPane.showMessageDialog(AppearancePanel.this, ex.getMessage(), "", JOptionPane.ERROR_MESSAGE);
}