Mercurial > cgi-bin > hgweb.cgi > JpegWasher
comparison src/name/blackcap/exifwasher/ShowDialog.kt @ 7:65d14d44bc3f
Works, but the column layout numbers are WEIRD.
author | David Barts <n5jrn@me.com> |
---|---|
date | Fri, 10 Apr 2020 13:44:04 -0700 |
parents | dc1f4359659d |
children | 0a106e9b91b4 |
comparison
equal
deleted
inserted
replaced
6:aafc9c127c7b | 7:65d14d44bc3f |
---|---|
22 private val BW = 9 | 22 private val BW = 9 |
23 private val BW2 = BW * 2 | 23 private val BW2 = BW * 2 |
24 private val WIDTH = 640 | 24 private val WIDTH = 640 |
25 private val HEIGHT = 480 | 25 private val HEIGHT = 480 |
26 | 26 |
27 private val myTable = JTable().apply { | 27 private val COLUMN_NAMES = arrayOf<String>("Key", "Type", "Value") |
28 private val myTable = JTable(arrayOf<Array<Any>>(), COLUMN_NAMES).apply { | |
28 autoCreateRowSorter = false | 29 autoCreateRowSorter = false |
29 rowSorter = null | 30 rowSorter = null |
30 columnModel.run { | 31 columnModel.run { |
31 getColumn(0).preferredWidth = 25 /* key name */ | 32 getColumn(0).preferredWidth = 25 /* key name */ |
32 getColumn(1).preferredWidth = 15 /* type */ | 33 getColumn(1).preferredWidth = 15 /* type */ |
67 if (tableData == null) { | 68 if (tableData == null) { |
68 JOptionPane.showMessageDialog(Application.mainFrame, | 69 JOptionPane.showMessageDialog(Application.mainFrame, |
69 "Unable to read metadata.", | 70 "Unable to read metadata.", |
70 "Error", JOptionPane.ERROR_MESSAGE) | 71 "Error", JOptionPane.ERROR_MESSAGE) |
71 } else { | 72 } else { |
72 val colNames = arrayOf("Key", "Type", "Value") | 73 myTable.model = MyTableModel(tableData, COLUMN_NAMES) |
73 myTable.apply { | |
74 model = MyTableModel(tableData, colNames) | |
75 validate() | |
76 } | |
77 setVisible(true) | 74 setVisible(true) |
78 } | 75 } |
79 } | 76 } |
80 } | 77 } |
81 } | 78 } |
82 | 79 |
83 private class MyTableModel(tData: Array<Array<String>>, cNames: Array<String>) : DefaultTableModel(tData, cNames) { | 80 private class MyTableModel(tData: Array<Array<String>>, cNames: Array<String>) : DefaultTableModel(tData, cNames) { |
84 override fun isCellEditable(row: Int, col: Int) = false | 81 override fun isCellEditable(row: Int, col: Int) = false |
85 override fun getColumnClass(col: Int) = String::class.java | 82 override fun getColumnClass(col: Int) = java.lang.String::class.java |
86 } | 83 } |
87 | 84 |
88 init { | 85 init { |
89 defaultCloseOperation = JDialog.DISPOSE_ON_CLOSE /* delete if reusing */ | 86 defaultCloseOperation = JDialog.DISPOSE_ON_CLOSE /* delete if reusing */ |
90 title = "Untitled" | 87 title = "Untitled" |