# HG changeset patch # User David Barts # Date 1586717172 25200 # Node ID 965435b85a69ef3b3be674c9ee0a91a3179a83e0 # Parent 39b977021ea17e0a714b7ce09a95e9bc90de5abc Get rid of some stuttering. diff -r 39b977021ea1 -r 965435b85a69 src/name/blackcap/exifwasher/Main.kt --- a/src/name/blackcap/exifwasher/Main.kt Sat Apr 11 16:12:59 2020 -0700 +++ b/src/name/blackcap/exifwasher/Main.kt Sun Apr 12 11:46:12 2020 -0700 @@ -12,8 +12,8 @@ val MYNAME = "ExifWasher" /* global UI objects */ - var mainFrame: MainFrame by SetOnce() - var settingsDialog: SettingsDialog by SetOnce() + var mainFrame: MainFrame by setOnce() + var settingsDialog: SettingsDialog by setOnce() fun initialize() { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); diff -r 39b977021ea1 -r 965435b85a69 src/name/blackcap/exifwasher/Misc.kt --- a/src/name/blackcap/exifwasher/Misc.kt Sat Apr 11 16:12:59 2020 -0700 +++ b/src/name/blackcap/exifwasher/Misc.kt Sun Apr 12 11:46:12 2020 -0700 @@ -23,7 +23,7 @@ * needed in Swing, because some vars inevitably need to be declared at * outer levels but initialized in the Swing event dispatch thread. */ -class SetOnce: ReadWriteProperty { +class SetOnceImpl: ReadWriteProperty { private var setOnceValue: T? = null override operator fun getValue(thisRef: Any?, property: KProperty<*>): T { @@ -43,6 +43,8 @@ } } +fun setOnce(): SetOnceImpl = SetOnceImpl() + /** * Run something in the Swing thread, asynchronously. * @param block lambda containing code to run