can no longer select separator in deck generator list of new duel dialog

master
wait321 2011-10-08 12:36:42 -07:00
parent 742042e1fa
commit 7632fccd7d
1 changed files with 17 additions and 2 deletions

View File

@ -229,15 +229,17 @@ public class TournamentDialog extends JDialog implements ActionListener {
} }
} }
private static class ColorsChooser extends JComboBox implements ListCellRenderer { private static class ColorsChooser extends JComboBox implements ListCellRenderer, ActionListener {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String lastSelected;
public ColorsChooser(final String colors) { public ColorsChooser(final String colors) {
this.setRenderer(this); this.setRenderer(this);
final DefaultComboBoxModel model=new DefaultComboBoxModel(); final DefaultComboBoxModel model = new DefaultComboBoxModel();
model.addElement("bug"); model.addElement("bug");
model.addElement("bur"); model.addElement("bur");
model.addElement("buw"); model.addElement("buw");
@ -277,7 +279,9 @@ public class TournamentDialog extends JDialog implements ActionListener {
setModel(model); setModel(model);
setSelectedItem(colors); setSelectedItem(colors);
lastSelected = colors;
this.setFocusable(false); this.setFocusable(false);
addActionListener(this);
} }
@Override @Override
@ -323,5 +327,16 @@ public class TournamentDialog extends JDialog implements ActionListener {
return panel; return panel;
} }
} }
public void actionPerformed(ActionEvent e) {
String tempItem = (String) getSelectedItem();
if (SEPARATOR.equals(tempItem)) {
// don't select separator
setSelectedItem(lastSelected);
} else {
lastSelected = tempItem;
}
}
} }
} }