comparison src/name/blackcap/imageprep/Menus.kt @ 30:098c4f5507c7

Convert to JDK 15.
author David Barts <n5jrn@me.com>
date Mon, 13 Jun 2022 11:31:49 -0700
parents 92afaa27f40a
children 99a0eb385c9a
comparison
equal deleted inserted replaced
29:e90d290a9a8d 30:098c4f5507c7
97 currentDirectory = currentInputDirectory 97 currentDirectory = currentInputDirectory
98 fileFilter = FileNameExtensionFilter("Image Files", *ImageIO.getReaderFileSuffixes()) 98 fileFilter = FileNameExtensionFilter("Image Files", *ImageIO.getReaderFileSuffixes())
99 } 99 }
100 if (chooser.showOpenDialog(Application.mainFrame) == JFileChooser.APPROVE_OPTION) { 100 if (chooser.showOpenDialog(Application.mainFrame) == JFileChooser.APPROVE_OPTION) {
101 currentInputDirectory = chooser.selectedFile.canonicalFile.parentFile 101 currentInputDirectory = chooser.selectedFile.canonicalFile.parentFile
102 RotateDialog.makeDialog(chooser.selectedFile, maxDim.value as Int) 102 RotateDialog.makeDialog(chooser.selectedFile, maxDim.value)
103 } 103 }
104 } 104 }
105 105
106 private fun doDiscard() { 106 private fun doDiscard() {
107 val w = FocusManager.getCurrentManager().activeWindow as? RotateDialog 107 val w = FocusManager.getCurrentManager().activeWindow as? RotateDialog
142 if (chooser.showSaveDialog(Application.mainFrame) != JFileChooser.APPROVE_OPTION) { 142 if (chooser.showSaveDialog(Application.mainFrame) != JFileChooser.APPROVE_OPTION) {
143 return 143 return
144 } 144 }
145 currentOutputDirectory = chooser.selectedFile.canonicalFile.parentFile 145 currentOutputDirectory = chooser.selectedFile.canonicalFile.parentFile
146 val (name, ext) = splitext(chooser.selectedFile.name) 146 val (name, ext) = splitext(chooser.selectedFile.name)
147 val file = if (ext.toLowerCase() in setOf(".jpg", ".jpeg")) { 147 val file = if (ext.lowercase() in setOf(".jpg", ".jpeg")) {
148 chooser.selectedFile 148 chooser.selectedFile
149 } else { 149 } else {
150 File(currentOutputDirectory, name + ".jpg") 150 File(currentOutputDirectory, name + ".jpg")
151 } 151 }
152 if (file.exists() && JOptionPane.showConfirmDialog(w, "File ${file.name} already exists. Overwrite?", "Confirm Overwrite", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { 152 if (file.exists() && JOptionPane.showConfirmDialog(w, "File ${file.name} already exists. Overwrite?", "Confirm Overwrite", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {