Make DeckGeneratorDialog fields non-static for more OOP-style.

This commit is contained in:
rkfg 2016-03-03 00:25:27 +03:00
parent d481c124ea
commit 6cfe43e9b7

View file

@ -48,13 +48,13 @@ import java.util.Date;
*/
public class DeckGeneratorDialog {
private static JDialog dlg;
private static String selectedColors;
private static JComboBox cbSets;
private static JComboBox cbDeckSize;
private static JButton btnGenerate, btnCancel;
private static JCheckBox cArtifacts, cSingleton, cNonBasicLands;
private static SimpleDateFormat dateFormat;
private JDialog dlg;
private String selectedColors;
private JComboBox<String> cbSets;
private JComboBox<String> cbDeckSize;
private JButton btnGenerate, btnCancel;
private JCheckBox cArtifacts, cSingleton, cNonBasicLands;
private SimpleDateFormat dateFormat;
public DeckGeneratorDialog()
{
@ -83,7 +83,7 @@ public class DeckGeneratorDialog {
p0.add(Box.createVerticalStrut(5));
JPanel jPanel = new JPanel();
JLabel text3 = new JLabel("Choose sets:");
cbSets = new JComboBox(ConstructedFormats.getTypes());
cbSets = new JComboBox<String>(ConstructedFormats.getTypes());
cbSets.setSelectedIndex(0);
cbSets.setPreferredSize(new Dimension(300, 25));
cbSets.setMaximumSize(new Dimension(300, 25));
@ -100,7 +100,7 @@ public class DeckGeneratorDialog {
p0.add(Box.createVerticalStrut(5));
JPanel jPanel2 = new JPanel();
JLabel textDeckSize = new JLabel("Deck size:");
cbDeckSize = new JComboBox(new String[]{"40","60"});
cbDeckSize = new JComboBox<String>(new String[] { "40", "60" });
cbDeckSize.setSelectedIndex(0);
cbDeckSize.setPreferredSize(new Dimension(300, 25));
cbDeckSize.setMaximumSize(new Dimension(300, 25));
@ -168,7 +168,7 @@ public class DeckGeneratorDialog {
dlg.dispose();
}
public static void cleanUp() {
public void cleanUp() {
for (ActionListener al: btnGenerate.getActionListeners()) {
btnGenerate.removeActionListener(al);
}
@ -187,7 +187,7 @@ public class DeckGeneratorDialog {
tmp.createNewFile();
deck.setName(deckName);
Sets.saveDeck(tmp.getAbsolutePath(), deck.getDeckCardLists());
DeckGeneratorDialog.cleanUp();
cleanUp();
return tmp.getAbsolutePath();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Couldn't generate deck. Try again.");