diff src/name/blackcap/imageprep/SettingsDialog.kt @ 21:0f3634a0816d

De-uglify SettingsDialog.
author David Barts <n5jrn@me.com>
date Sat, 21 Nov 2020 21:25:05 -0800
parents 71029c9bf7cd
children d3979a2155a8
line wrap: on
line diff
--- a/src/name/blackcap/imageprep/SettingsDialog.kt	Sat Nov 21 10:15:35 2020 -0800
+++ b/src/name/blackcap/imageprep/SettingsDialog.kt	Sat Nov 21 21:25:05 2020 -0800
@@ -52,14 +52,18 @@
     
     /* output to input dir? */
     private val otid = _PROPS.getBoolean("outputToInputDir")
-    private val outputToInputButton = JRadioButton("Create output file in same folder as input.", otid)
+    private val outputToInputButton = JRadioButton("Create output file in same folder as input.", otid).apply {
+        alignmentX = LEFT_ALIGNMENT
+    }
     val outputToInputDir: Boolean
     get() {
         return outputToInputButton.isSelected()
     }
     
     /* output to some other directory */
-    private val outputToButton = JRadioButton("Create output file in:", !otid)
+    private val outputToButton = JRadioButton("Create output file in:", !otid).apply {
+        alignmentX = LEFT_ALIGNMENT
+    }
     
     /* name of the other directory */
     private val oto = _getOutputTo()
@@ -124,33 +128,41 @@
         contentPane.apply {
             layout = BoxLayout(this, BoxLayout.Y_AXIS)
             add(Box(BoxLayout.X_AXIS).apply {
+                alignmentX = LEFT_ALIGNMENT
                 border = BorderFactory.createEmptyBorder(BW2, BW2, BW, BW2)
-                add(leftLabel("Maximum dimension:"))
+                add(leftLabel("Maximum dimension: "))
                 add(_maxDimension)
                 add(Box.createGlue())
-                add(leftLabel("Output quality:"))
+                add(leftLabel("Output quality: "))
                 add(_outputQuality)
             })
             add(Box(BoxLayout.X_AXIS).apply {
+                alignmentX = LEFT_ALIGNMENT
                 border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2)
-                add(leftLabel("Output filename suffix:"))
+                add(leftLabel("Output filename suffix: "))
                 add(_outputSuffix)
                 add(Box.createGlue())
             })
             add(Box(BoxLayout.Y_AXIS).apply {
-                border = BorderFactory.createEmptyBorder(BW, BW2, BW2, BW2)
+                alignmentX = LEFT_ALIGNMENT
+                border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2)
                 add(outputToInputButton)
                 add(outputToButton)
                 add(Box(BoxLayout.X_AXIS).apply {
+                    alignmentX = LEFT_ALIGNMENT
                     add(outputToText)
                     add(changeOutputTo)
                     add(Box.createGlue())
                 })
             })
             add(Box(BoxLayout.X_AXIS).apply {
+                alignmentX = LEFT_ALIGNMENT
+                border = BorderFactory.createEmptyBorder(BW, BW2, BW2, BW2)
+                add(Box.createGlue())
                 add(_cancel)
                 add(Box.createGlue())
                 add(_ok)
+                add(Box.createGlue())
             })
         }
         rootPane.setDefaultButton(_ok)
@@ -199,7 +211,10 @@
         }
     }
     
-    private fun _getOutputTo(): String = _PROPS.getProperty("outputTo") ?: System.getProperty("user.dir")
+    private fun _getOutputTo(): String {
+        val p = _PROPS.getProperty("outputTo")
+        return if (p != null) tilde(p) else System.getProperty("user.dir")
+    }
 }
 
 fun Properties.getString(key: String): String = getProperty(key) as String