OSDN Git Service

いんきゅばす起動処理
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / Main.java
1 package yukihane.inqubus;
2
3 import java.nio.file.FileSystem;
4 import java.nio.file.FileSystems;
5 import java.nio.file.Path;
6 import java.util.logging.Logger;
7 import javax.swing.UIManager;
8 import javax.swing.UIManager.LookAndFeelInfo;
9 import javax.swing.UnsupportedLookAndFeelException;
10 import org.apache.commons.configuration.ConfigurationException;
11 import yukihane.inqubus.config.Properties;
12 import yukihane.inqubus.gui.MainFrame;
13
14 /**
15  * いんきゅばす起動クラス.
16  * @author yuki
17  */
18 public class Main {
19
20     private static final Logger logger = Logger.getLogger(Main.class.getName());
21
22 //    public static void main(String[] args) {
23 //        final FileSystem fileSystem = FileSystems.getDefault();
24 //        final Path path = fileSystem.getPath("inqubus.xml");
25 //        try {
26 //            Properties.INSTANCE.load(path.toString());
27 //        } catch (ConfigurationException ex) {
28 //            logger.info("コンフィグファイルが無いためデフォルト値で起動");
29 //        }
30 //
31 //        SwingUtilities.invokeLater(new Runnable() {
32 //
33 //            @Override
34 //            public void run() {
35 //                final MainFrame frame = new MainFrame();
36 //                frame.setVisible(true);
37 //            }
38 //        });
39 //
40 //    }
41     public static void main(String args[]) {
42         final FileSystem fileSystem = FileSystems.getDefault();
43         final Path path = fileSystem.getPath("inqubus.xml");
44         try {
45             Properties.INSTANCE.load(path.toString());
46         } catch (ConfigurationException ex) {
47             logger.info("コンフィグファイルが無いためデフォルト値で起動");
48         }
49
50         try {
51             for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
52                 if ("Nimbus".equals(info.getName())) {
53                     UIManager.setLookAndFeel(info.getClassName());
54                     break;
55                 }
56             }
57         } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
58             try {
59                 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
60             } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
61                 // System Look & Feel も無いことは無いだろう
62             }
63         }
64         java.awt.EventQueue.invokeLater(new Runnable() {
65
66             public void run() {
67                 new MainFrame().setVisible(true);
68             }
69         });
70     }
71 }