1 package yukihane.inqubus;
3 import java.io.IOException;
4 import java.nio.file.Path;
5 import java.nio.file.Paths;
6 import java.util.logging.Level;
7 import java.util.logging.Logger;
8 import javax.swing.JOptionPane;
9 import javax.swing.UIManager;
10 import javax.swing.UIManager.LookAndFeelInfo;
11 import javax.swing.UnsupportedLookAndFeelException;
12 import org.apache.commons.configuration.ConfigurationException;
13 import yukihane.inqubus.config.Config;
14 import yukihane.inqubus.gui.MainFrame;
15 import yukihane.inqubus.saccubus.prompt.Prompt;
23 private static final Logger logger = Logger.getLogger(Main.class.getName());
25 public static void main(String args[]) {
26 final Path path = Paths.get("inqubus.xml");
29 Config.INSTANCE.load(path.toString());
31 } catch (ConfigurationException ex) {
33 logger.log(Level.FINER, "コンフィグファイルが無いためデフォルト値で起動", ex);
36 // 第1引数がメールアドレスと思しき時はさきゅばすフォーマットのコマンドラインであるとみなしてパース
37 if (args.length > 0 && args[0].contains("@")) {
39 new Prompt().main(args);
40 } catch (Exception ex) {
41 logger.log(Level.SEVERE, "処理が正常終了しませんでした", ex);
46 final RunWindow invoke = new RunWindow(showWelcome);
47 java.awt.EventQueue.invokeLater(invoke);
50 private static class RunWindow implements Runnable {
52 private final boolean showWelcome;
54 private RunWindow(boolean showWelcome) {
55 this.showWelcome = showWelcome;
61 final MainFrame frame = new MainFrame();
63 frame.setVisible(true);
65 JOptionPane.showMessageDialog(frame,
66 "<html>設定はメニューの <b>ツール > オプション</b> から行えます</html>",
67 "いんきゅばすへようこそ", JOptionPane.INFORMATION_MESSAGE);
72 private static void setLookAndFeel() {
74 for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
75 if ("Nimbus".equals(info.getName())) {
76 UIManager.setLookAndFeel(info.getClassName());
80 } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
82 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
83 } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
84 // System Look & Feel も無いことは無いだろう