Mercurial > cgi-bin > hgweb.cgi > ImagePrep
comparison src/name/blackcap/imageprep/Menus.kt @ 31:99a0eb385c9a default tip
Work around annoying Swing glitch.
author | David Barts <n5jrn@me.com> |
---|---|
date | Sat, 20 Aug 2022 09:19:49 -0700 |
parents | 098c4f5507c7 |
children |
comparison
equal
deleted
inserted
replaced
30:098c4f5507c7 | 31:99a0eb385c9a |
---|---|
136 val outName = splitext(w.file.name).first + Application.settingsDialog.outputSuffix + ".jpg" | 136 val outName = splitext(w.file.name).first + Application.settingsDialog.outputSuffix + ".jpg" |
137 val chooser = JFileChooser().apply { | 137 val chooser = JFileChooser().apply { |
138 accessory = acc | 138 accessory = acc |
139 currentDirectory = currentOutputDirectory | 139 currentDirectory = currentOutputDirectory |
140 selectedFile = File(currentOutputDirectory, outName) | 140 selectedFile = File(currentOutputDirectory, outName) |
141 } | |
142 /* swing glitch workaround from https://stackoverflow.com/questions/14640103/jfilechooser-not-showing-up */ | |
143 if (!chooser.isVisible()) { | |
144 chooser.setVisible(true) | |
145 chooser.requestFocus() | |
141 } | 146 } |
142 if (chooser.showSaveDialog(Application.mainFrame) != JFileChooser.APPROVE_OPTION) { | 147 if (chooser.showSaveDialog(Application.mainFrame) != JFileChooser.APPROVE_OPTION) { |
143 return | 148 return |
144 } | 149 } |
145 currentOutputDirectory = chooser.selectedFile.canonicalFile.parentFile | 150 currentOutputDirectory = chooser.selectedFile.canonicalFile.parentFile |