comparison src/name/blackcap/exifwasher/ShowDialog.kt @ 9:0a106e9b91b4

Fix table layout; fix "select all for deletion" feature.
author David Barts <n5jrn@me.com>
date Fri, 10 Apr 2020 19:17:09 -0700
parents 65d14d44bc3f
children 9bbe6d803eba
comparison
equal deleted inserted replaced
8:88d02fa97d78 9:0a106e9b91b4
26 26
27 private val COLUMN_NAMES = arrayOf<String>("Key", "Type", "Value") 27 private val COLUMN_NAMES = arrayOf<String>("Key", "Type", "Value")
28 private val myTable = JTable(arrayOf<Array<Any>>(), COLUMN_NAMES).apply { 28 private val myTable = JTable(arrayOf<Array<Any>>(), COLUMN_NAMES).apply {
29 autoCreateRowSorter = false 29 autoCreateRowSorter = false
30 rowSorter = null 30 rowSorter = null
31 columnModel.run {
32 getColumn(0).preferredWidth = 25 /* key name */
33 getColumn(1).preferredWidth = 15 /* type */
34 getColumn(2).preferredWidth = 100 /* value */
35 }
36 } 31 }
37 32
38 /* deliberately not the default, because this changes a file */ 33 /* deliberately not the default, because this changes a file */
39 private val dismissButton = JButton("Dismiss").also { 34 private val dismissButton = JButton("Dismiss").also {
40 it.addActionListener(ActionListener { close() }) 35 it.addActionListener(ActionListener { close() })
68 if (tableData == null) { 63 if (tableData == null) {
69 JOptionPane.showMessageDialog(Application.mainFrame, 64 JOptionPane.showMessageDialog(Application.mainFrame,
70 "Unable to read metadata.", 65 "Unable to read metadata.",
71 "Error", JOptionPane.ERROR_MESSAGE) 66 "Error", JOptionPane.ERROR_MESSAGE)
72 } else { 67 } else {
73 myTable.model = MyTableModel(tableData, COLUMN_NAMES) 68 myTable.run {
69 model = MyTableModel(tableData, COLUMN_NAMES)
70 autoResizeMode = JTable.AUTO_RESIZE_OFF
71 setColWidth(0, 180, null)
72 setColWidth(1, 72, "Undefined")
73 setColWidth(2, 720, null)
74 setOverallWidth()
75 }
74 setVisible(true) 76 setVisible(true)
75 } 77 }
76 } 78 }
77 } 79 }
78 } 80 }