Skip to content

Commit

Permalink
Fix bug #19
Browse files Browse the repository at this point in the history
  • Loading branch information
Guo Yunhe committed Sep 11, 2015
1 parent 0705755 commit c520c0a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/me/guoyunhe/fontweak/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ private void newSchemeButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
// Add and select new scheme item in ComboBox
schemeComboBox.addItem(scheme);
schemeComboBox.setSelectedItem(scheme);
deleteSchemeButton.setEnabled(true);
}
}//GEN-LAST:event_newSchemeButtonActionPerformed

Expand Down Expand Up @@ -779,6 +780,10 @@ private void deleteSchemeButtonActionPerformed(java.awt.event.ActionEvent evt) {
schemeComboBox.removeItem(scheme);
// This will trigger schemeComboBoxActionPerformed() function, and load
// new scheme automatically

if (schemeComboBox.getItemCount() == 1) {
deleteSchemeButton.setEnabled(false);
}

// If deleted current scheme, set current scheme to new selected scheme
if (schemeManager.getCurrentSchemeName().equals(scheme)) {
Expand Down Expand Up @@ -951,6 +956,9 @@ private void loadSchemes() {
if (schemeList == null) {
schemeList = new String[]{java.util.ResourceBundle.getBundle("me/guoyunhe/fontweak/i18n/translation").getString("DEFAULT")};
}
if (schemeList.length == 1) {
this.deleteSchemeButton.setEnabled(false);
}
schemeComboBoxModel = new DefaultComboBoxModel(schemeList);
schemeComboBox.setModel(schemeComboBoxModel);
// Set current scheme
Expand Down

0 comments on commit c520c0a

Please sign in to comment.