Skip to content

Commit

Permalink
Execute Swing init code in Swing event thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentg committed Oct 2, 2014
1 parent 1e107d6 commit 5d619be
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions src/main/java/org/truffautronic/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,36 @@
import java.io.File;
import java.util.Locale;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import org.truffautronic.controller.AppController;
import org.truffautronic.controller.I18N;

public class Main {

public static void main(String[] args) throws Exception {

I18N.setLocale(Locale.getDefault());

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

UIManager.put("TabbedPane.selected", Color.YELLOW);
UIManager.put("ToggleButton.select", Color.YELLOW);

AppController appController = new AppController();
if (args.length >= 1) {
appController.openInitialFile(new File(args[0]));
}
appController.run();
public static void main(final String[] args) throws Exception {

SwingUtilities.invokeLater(new Runnable() {
public void run() {
I18N.setLocale(Locale.getDefault());

try {
UIManager.setLookAndFeel(UIManager
.getSystemLookAndFeelClassName());
} catch (Exception e) {
throw new RuntimeException(e);
}

UIManager.put("TabbedPane.selected", Color.YELLOW);
UIManager.put("ToggleButton.select", Color.YELLOW);

AppController appController = new AppController();
if (args.length >= 1) {
appController.openInitialFile(new File(args[0]));
}
appController.run();
}
});
}
}

0 comments on commit 5d619be

Please sign in to comment.