Mercurial > cgi-bin > hgweb.cgi > JpegWasher
annotate src/name/blackcap/exifwasher/Misc.kt @ 5:dc1f4359659d
Got it compiling.
author | David Barts <n5jrn@me.com> |
---|---|
date | Thu, 09 Apr 2020 18:20:34 -0700 |
parents | 19c381c536ec |
children | 88d02fa97d78 |
rev | line source |
---|---|
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
1 /* |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
2 * Miscellaneous utility stuff. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
3 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
4 package name.blackcap.exifwasher |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
5 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
6 import java.awt.Component |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
7 import java.awt.Cursor |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
8 import java.awt.Toolkit |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
9 import javax.swing.* |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
10 import kotlin.annotation.* |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
11 import kotlin.properties.ReadWriteProperty |
5 | 12 import kotlin.reflect.* |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
13 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
14 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
15 * Delegate that makes a var that can only be set once. This is commonly |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
16 * needed in Swing, because some vars inevitably need to be declared at |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
17 * outer levels but initialized in the Swing event dispatch thread. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
18 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
19 class SetOnce<T: Any>: ReadWriteProperty<Any?,T> { |
5 | 20 private var setOnceValue: T? = null |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
21 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
22 override operator fun getValue(thisRef: Any?, property: KProperty<*>): T { |
5 | 23 if (setOnceValue == null) { |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
24 throw RuntimeException("${property.name} has not been initialized") |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
25 } else { |
5 | 26 return setOnceValue!! |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
27 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
28 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
29 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
30 @Synchronized |
5 | 31 override operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T): Unit { |
32 if (setOnceValue != null) { | |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
33 throw RuntimeException("${property.name} has already been initialized") |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
34 } |
5 | 35 setOnceValue = value |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
36 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
37 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
38 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
39 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
40 * Run something in the Swing thread, asynchronously. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
41 * @param block lambda containing code to run |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
42 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
43 fun inSwingThread(block: () -> Unit) { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
44 SwingUtilities.invokeLater(Runnable(block)) |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
45 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
46 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
47 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
48 * Run something in the Swing thread, synchronously. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
49 * @param block lambda containing code to run |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
50 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
51 fun inSynSwingThread(block: () -> Unit) { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
52 SwingUtilities.invokeAndWait(Runnable(block)) |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
53 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
54 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
55 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
56 * Make a shortcut for a menu item, using the standard combining key |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
57 * (control, command, etc.) for the system we're on. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
58 * @param key KeyEvent constant describing the key |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
59 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
60 fun JMenuItem.makeShortcut(key: Int): Unit { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
61 val SC_KEY_MASK = Toolkit.getDefaultToolkit().menuShortcutKeyMask |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
62 setAccelerator(KeyStroke.getKeyStroke(key, SC_KEY_MASK)) |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
63 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
64 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
65 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
66 * Given a MenuElement object, get the item whose text matches the |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
67 * specified text. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
68 * @param text to match |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
69 * @return first matched element, null if no match found |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
70 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
71 fun MenuElement.getItem(name: String) : JMenuItem? { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
72 subElements.forEach { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
73 val jMenuItem = it.component as? JMenuItem |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
74 if (jMenuItem?.text == name) { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
75 return jMenuItem |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
76 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
77 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
78 return null |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
79 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
80 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
81 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
82 * Change to the standard wait cursor. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
83 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
84 fun Component.useWaitCursor() { |
5 | 85 this.cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
86 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
87 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
88 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
89 * Return back to the normal cursor(). |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
90 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
91 fun Component.useNormalCursor() { |
5 | 92 this.cursor = Cursor.getDefaultCursor() |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
93 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
94 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
95 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
96 * Thrown if the programmer botches something in our DSL. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
97 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
98 class SwingWorkerException(message: String): Exception(message) { } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
99 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
100 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
101 * A simplified SwingWorker DSL. It does not support intermediate |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
102 * results. Just lets one define a background task and something |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
103 * to execute when complete. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
104 * |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
105 * @param T Type returned by inBackground (Java doInBackground) task. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
106 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
107 class SwingWorkerBuilder<T>: SwingWorker<T,Unit>() { |
5 | 108 private var inBackgroundLambda: (SwingWorkerBuilder<T>.() -> T)? = null |
109 private var whenDoneLambda: (SwingWorkerBuilder<T>.() -> Unit)? = null | |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
110 |
5 | 111 private fun <U> setOnce(prop: KMutableProperty0<(SwingWorkerBuilder<T>.() -> U)?>, value: SwingWorkerBuilder<T>.() -> U) { |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
112 if (prop.get() != null) { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
113 throw SwingWorkerException(prop.name.removeSuffix("Lambda") + " already defined!") |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
114 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
115 prop.set(value) |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
116 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
117 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
118 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
119 * Define the inBackground task. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
120 */ |
5 | 121 fun inBackground(lambda: SwingWorkerBuilder<T>.() -> T): Unit { |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
122 setOnce<T>(::inBackgroundLambda, lambda) |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
123 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
124 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
125 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
126 * Define the whenDone task. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
127 */ |
5 | 128 fun whenDone(lambda: SwingWorkerBuilder<T>.() -> Unit): Unit { |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
129 setOnce<Unit>(::whenDoneLambda, lambda) |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
130 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
131 |
5 | 132 /** |
133 * Validates we've been properly initialized. | |
134 */ | |
135 fun validate(): Unit { | |
136 if (inBackgroundLambda == null) { | |
137 throw SwingWorkerException("inBackground not defined!") | |
138 } | |
139 } | |
140 | |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
141 /* standard overrides for SwingWorker follow */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
142 |
5 | 143 override fun doInBackground(): T = inBackgroundLambda!!.invoke(this) |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
144 |
5 | 145 override fun done(): Unit = whenDoneLambda?.invoke(this) ?: Unit |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
146 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
147 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
148 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
149 * Provides for an outer swingWorker block to contain the DSL. |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
150 */ |
5 | 151 fun <T> swingWorker(initializer: SwingWorkerBuilder<T>.() -> Unit): Unit { |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
152 SwingWorkerBuilder<T>().run { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
153 initializer() |
5 | 154 validate() |
3
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
155 execute() |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
156 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
157 } |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
158 |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
159 /** |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
160 * Close a dialog (don't just hide it). |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
161 */ |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
162 fun JDialog.close() { |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
163 setVisible(false) |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
164 dispose() |
19c381c536ec
Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
165 } |