import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
+import java.util.logging.Logger;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+import javax.swing.UnsupportedLookAndFeelException;
+import org.apache.commons.configuration.ConfigurationException;
+import yukihane.inqubus.config.Properties;
+import yukihane.inqubus.gui.MainFrame;
/**
* いんきゅばす起動クラス.
*/
public class Main {
- public static void main(String[] args) {
+ private static final Logger logger = Logger.getLogger(Main.class.getName());
+
+// public static void main(String[] args) {
+// final FileSystem fileSystem = FileSystems.getDefault();
+// final Path path = fileSystem.getPath("inqubus.xml");
+// try {
+// Properties.INSTANCE.load(path.toString());
+// } catch (ConfigurationException ex) {
+// logger.info("コンフィグファイルが無いためデフォルト値で起動");
+// }
+//
+// SwingUtilities.invokeLater(new Runnable() {
+//
+// @Override
+// public void run() {
+// final MainFrame frame = new MainFrame();
+// frame.setVisible(true);
+// }
+// });
+//
+// }
+ public static void main(String args[]) {
final FileSystem fileSystem = FileSystems.getDefault();
final Path path = fileSystem.getPath("inqubus.xml");
- System.out.println(path.toAbsolutePath());
+ try {
+ Properties.INSTANCE.load(path.toString());
+ } catch (ConfigurationException ex) {
+ logger.info("コンフィグファイルが無いためデフォルト値で起動");
+ }
+
+ try {
+ for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+ if ("Nimbus".equals(info.getName())) {
+ UIManager.setLookAndFeel(info.getClassName());
+ break;
+ }
+ }
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
+ // System Look & Feel も無いことは無いだろう
+ }
+ }
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new MainFrame().setVisible(true);
+ }
+ });
}
}