diff src/name/blackcap/imageprep/Main.kt @ 0:e0efe7848130

Initial commit. Untested!
author David Barts <davidb@stashtea.com>
date Thu, 16 Jul 2020 19:57:23 -0700
parents
children 5234e4500d45
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/name/blackcap/imageprep/Main.kt	Thu Jul 16 19:57:23 2020 -0700
@@ -0,0 +1,36 @@
+/*
+ * Entry point, etc.
+ */
+package name.blackcap.imageprep
+
+import javax.swing.UIManager
+import java.util.logging.Level
+import java.util.logging.Logger
+
+object Application {
+    /* name we call ourselves */
+    val MYNAME = "ImagePrep"
+
+    /* global UI objects */
+    var mainFrame: MainFrame by setOnce()
+    var helpDialog: HelpDialog by setOnce()
+
+    fun initialize() {
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        mainFrame = MainFrame() /* must be created first */
+        mainFrame.jMenuBar = MyMenuBar()
+        setMacMenus() /* always safe to call; no-op if not a Mac */
+        helpDialog = HelpDialog()
+        mainFrame.setVisible(true)
+    }
+}
+
+fun main(args: Array<String>) {
+    LOGGER.log(Level.INFO, "beginning execution")
+    if (OS.type == OS.MAC) {
+        System.setProperty("apple.laf.useScreenMenuBar", "true")
+    }
+    inSwingThread {
+        Application.initialize()
+    }
+}