diff src/name/blackcap/imageprep/MaxDimSpinner.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/MaxDimSpinner.kt	Sat Nov 21 10:15:35 2020 -0800
+++ b/src/name/blackcap/imageprep/MaxDimSpinner.kt	Sat Nov 21 21:25:05 2020 -0800
@@ -3,6 +3,7 @@
  */
 package name.blackcap.imageprep
 
+import java.awt.Dimension
 import java.awt.Toolkit
 import javax.swing.*
 import javax.swing.event.ChangeEvent
@@ -19,9 +20,11 @@
 class MaxDimSpinner(val default: Int): JSpinner(SpinnerListModel(STDDIMS))
 {
     init {
-        editor = JSpinner.ListEditor(this)
+        editor = JSpinner.ListEditor(this).apply {
+            textField.columns = STDDIMS.map { it.toString().length }.max() ?: 1
+        }
         value = default
-        noTaller()
+        maximumSize = preferredSize
         addChangeListener( ChangeListener {
             val v = value as? Int ?: (value as? String)?.toIntOrNull()
             if ( v == null || v < 1 || v > MAXDIM ) {