catch some errors in font selections
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 8 May 2008 22:42:24 +0000 (22:42 +0000)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 8 May 2008 22:42:24 +0000 (22:42 +0000)
fix look & feel combobox enabled status when opening dialog

git-svn-id: http://trooper/svn/projects/jSite/trunk@794 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/jsite/gui/ConfigurationDialog.java

index 00c0776..f398200 100644 (file)
@@ -20,6 +20,7 @@ import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
 import javax.swing.JComponent;
 import javax.swing.JDialog;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JSpinner;
 import javax.swing.JTabbedPane;
@@ -268,6 +269,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                        LookAndFeelWrapper lookAndFeelWrapper = (LookAndFeelWrapper) customLAFComboBox.getItemAt(lookAndFeelIndex);
                        if (lookAndFeelWrapper.getClassName().equals(lookAndFeel)) {
                                customLAFComboBox.setSelectedIndex(lookAndFeelIndex);
+                               customLAFComboBox.setEnabled(true);
                                useCustomLAFCheckBox.setSelected(true);
                                break;
                        }
@@ -456,6 +458,18 @@ public class ConfigurationDialog extends JDialog implements I18nable {
         * Called when the “okay” button is clicked.
         */
        private void actionOkay() {
+               if (useCustomControlFontCheckBox.isSelected()) {
+                       if (controlFontList.getSelectedItem() == null) {
+                               JOptionPane.showMessageDialog(this, I18n.get("configurationDialog.error.noControlFontSelected.message"), I18n.get("configurationDialog.error.noControlFontSelected.title"), JOptionPane.ERROR_MESSAGE);
+                               return;
+                       }
+               }
+               if (useCustomUserFontCheckBox.isSelected()) {
+                       if (userFontList.getSelectedItem() == null) {
+                               JOptionPane.showMessageDialog(this, I18n.get("configurationDialog.error.noUserFontSelected.message"), I18n.get("configurationDialog.error.noUserFontSelected.title"), JOptionPane.ERROR_MESSAGE);
+                               return;
+                       }
+               }
                cancelled = false;
                setVisible(false);
        }