view src/name/blackcap/exifwasher/Main.kt @ 3:19c381c536ec

Code to make it a proper Mac GUI app. Untested!
author David Barts <n5jrn@me.com>
date Wed, 08 Apr 2020 20:29:12 -0700
parents
children dc1f4359659d
line wrap: on
line source

/*
 * Entry point, etc.
 */
package name.blackcap.exifwasher

import javax.swing.UIManager

object Application {
    /* name we call ourselves */
    val MYNAME = "ExifWasher"

    /* global UI objects */
    var mainFrame: MainFrame by SetOnce<MainFrame>()
    var settingsDialog: SettingsDialog by SetOnce<SettingsDialog>()

    fun initialize() {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        mainFrame = MainFrame() /* must be created first */
        settingsDialog = SettingsDialog()
        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()
    }
}