text.setAlignmentX(Component.CENTER_ALIGNMENT);
p0.add(text);
p0.add(Box.createVerticalStrut(5));
String chosen = MageFrame.getPreferences().get("genDeckColor", "u");
final ColorsChooser colorsChooser = new ColorsChooser(chosen);
p0.add(colorsChooser);
p0.add(Box.createVerticalStrut(5));
JLabel text2 = new JLabel("(X - random color)");
text2.setAlignmentX(Component.CENTER_ALIGNMENT);
p0.add(text2);
p0.add(Box.createVerticalStrut(5));
JPanel jPanel = new JPanel();
JLabel text3 = new JLabel("Choose sets:");
cbSets = new JComboBox(ConstructedFormats.getTypes());
cbSets.setSelectedIndex(0);
cbSets.setPreferredSize(new Dimension(300, 25));
cbSets.setMaximumSize(new Dimension(300, 25));
cbSets.setAlignmentX(Component.LEFT_ALIGNMENT);
jPanel.add(text3);
jPanel.add(cbSets);
p0.add(jPanel);
String prefSet = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_DECK_GENERATOR_SET, null);
if (prefSet != null) {
cbSets.setSelectedItem(prefSet);
}
p0.add(Box.createVerticalStrut(5));
JPanel jPanel2 = new JPanel();
JLabel textDeckSize = new JLabel("Deck size:");
cbDeckSize = new JComboBox(new String[]{"40","60"});
cbDeckSize.setSelectedIndex(0);
cbDeckSize.setPreferredSize(new Dimension(300, 25));
cbDeckSize.setMaximumSize(new Dimension(300, 25));
cbDeckSize.setAlignmentX(Component.LEFT_ALIGNMENT);
jPanel2.add(textDeckSize);
jPanel2.add(cbDeckSize);
p0.add(jPanel2);
String prefSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_DECK_GENERATOR_DECK_SIZE, "60");
if (prefSet != null) {
cbDeckSize.setSelectedItem(prefSize);
}
final JButton btnGenerate = new JButton("Ok");
btnGenerate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
btnGenerate.setEnabled(false);
colorsChooser.setEnabled(false);
selectedColors = (String) colorsChooser.getSelectedItem();
dlg.setVisible(false);
MageFrame.getPreferences().put("genDeckColor", selectedColors);
}
});
final JButton btnCancel = new JButton("Cancel");