-
- int value = chooser.showOpenDialog(this);
-
- if (value != JalviewFileChooser.APPROVE_OPTION)
- {
- return;
- }
- File choice = chooser.getSelectedFile();
- Cache.setProperty(LAST_DIRECTORY, choice.getParent());
-
- UserColourScheme ucs = ColourSchemeLoader
- .loadColourScheme(choice.getAbsolutePath());
- Color[] colors = ucs.getColours();
- schemeName.setText(ucs.getSchemeName());
-
- if (ucs.getLowerCaseColours() != null)
- {
- caseSensitive.setSelected(true);
- lcaseColour.setEnabled(true);
- resetButtonPanel(true);
- for (int i = 0; i < lowerCaseButtons.size(); i++)
- {
- JButton button = lowerCaseButtons.get(i);
- button.setBackground(ucs.getLowerCaseColours()[i]);
- }
- }
- else
- {
- caseSensitive.setSelected(false);
- lcaseColour.setEnabled(false);
- resetButtonPanel(false);
- }
-
- for (int i = 0; i < upperCaseButtons.size(); i++)
- {
- JButton button = upperCaseButtons.get(i);
- button.setBackground(colors[i]);
- }
-
- addNewColourScheme(choice.getPath());
+ chooser.setResponseHandler(0, new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ File choice = chooser.getSelectedFile();
+ Cache.setProperty(LAST_DIRECTORY, choice.getParent());
+
+ UserColourScheme ucs = ColourSchemeLoader
+ .loadColourScheme(choice.getAbsolutePath());
+ Color[] colors = ucs.getColours();
+ schemeName.setText(ucs.getSchemeName());
+
+ if (ucs.getLowerCaseColours() != null)
+ {
+ caseSensitive.setSelected(true);
+ lcaseColour.setEnabled(true);
+ resetButtonPanel(true);
+ for (int i = 0; i < lowerCaseButtons.size(); i++)
+ {
+ JButton button = lowerCaseButtons.get(i);
+ button.setBackground(ucs.getLowerCaseColours()[i]);
+ }
+ }
+ else
+ {
+ caseSensitive.setSelected(false);
+ lcaseColour.setEnabled(false);
+ resetButtonPanel(false);
+ }
+
+ for (int i = 0; i < upperCaseButtons.size(); i++)
+ {
+ JButton button = upperCaseButtons.get(i);
+ button.setBackground(colors[i]);
+ }
+
+ addNewColourScheme(choice.getPath());
+ }
+ });
+
+ chooser.showOpenDialog(this);