Mercurial > cgi-bin > hgweb.cgi > JpegWasher
comparison src/name/blackcap/exifwasher/MainFrame.kt @ 5:dc1f4359659d
Got it compiling.
author | David Barts <n5jrn@me.com> |
---|---|
date | Thu, 09 Apr 2020 18:20:34 -0700 |
parents | 19c381c536ec |
children | aafc9c127c7b |
comparison
equal
deleted
inserted
replaced
4:ba5dc14652da | 5:dc1f4359659d |
---|---|
5 | 5 |
6 import java.awt.Dimension | 6 import java.awt.Dimension |
7 import java.awt.datatransfer.DataFlavor | 7 import java.awt.datatransfer.DataFlavor |
8 import java.awt.datatransfer.Transferable | 8 import java.awt.datatransfer.Transferable |
9 import java.awt.datatransfer.UnsupportedFlavorException | 9 import java.awt.datatransfer.UnsupportedFlavorException |
10 import java.awt.event.WindowEvent | |
11 import java.awt.event.WindowListener | |
10 import java.io.File | 12 import java.io.File |
11 import java.io.IOException | 13 import java.io.IOException |
12 import javax.swing.JFrame | 14 import java.util.logging.Level |
13 import javax.swing.TransferHandler | 15 import java.util.logging.Logger |
14 | 16 import javax.swing.* |
15 class MainFrame: JFrame { | |
16 | 17 |
17 /* the main frame itself */ | 18 /* the main frame itself */ |
18 class MainFrame : JFrame(Application.MYNAME) { | 19 class MainFrame : JFrame(Application.MYNAME) { |
19 /* default size */ | 20 /* default size */ |
20 val WIDTH = 512 | 21 val WIDTH = 512 |
36 System.exit(0) | 37 System.exit(0) |
37 } | 38 } |
38 } | 39 } |
39 | 40 |
40 /* acts on dragged files */ | 41 /* acts on dragged files */ |
41 private class MyTransferHandler : TransferHandler { | 42 private class MyTransferHandler : TransferHandler() { |
42 override fun canImport(support: TransferHandler.TransferSupport): Boolean { | 43 override fun canImport(support: TransferHandler.TransferSupport): Boolean { |
43 return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor) | 44 return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor) |
44 } | 45 } |
45 | 46 |
46 override fun importData(support: TransferHandler.TransferSupport): Boolean { | 47 override fun importData(support: TransferHandler.TransferSupport): Boolean { |
47 if (!canImport(support)) { | 48 if (!canImport(support)) { |
48 return false | 49 return false |
49 } | 50 } |
50 val files = try { | 51 val files = try { |
51 support.transferable.getTransferData(DataFlavor.javaFileListFlavor) as java.util.List<File> | 52 support.transferable.getTransferData(DataFlavor.javaFileListFlavor) as List<File> |
52 } catch (e: UnsupportedFlavorException) { | 53 } catch (e: UnsupportedFlavorException) { |
53 return false | 54 return false |
54 } catch (e: IOException) { | 55 } catch (e: IOException) { |
55 return false | 56 return false |
56 } | 57 } |