From b300c3c114606721e7dfeec4bf4969b4789ca789 Mon Sep 17 00:00:00 2001 From: Julius de Jeu Date: Thu, 17 Jan 2019 17:33:09 +0100 Subject: [PATCH] Update Main --- .../kotlin/nl/aegeedelft/watermarker/Main.kt | 49 ++++++++----------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/src/main/kotlin/nl/aegeedelft/watermarker/Main.kt b/src/main/kotlin/nl/aegeedelft/watermarker/Main.kt index ffabe4d..81ce6e5 100644 --- a/src/main/kotlin/nl/aegeedelft/watermarker/Main.kt +++ b/src/main/kotlin/nl/aegeedelft/watermarker/Main.kt @@ -22,11 +22,6 @@ val filenameRegex = ".*\\.(png|jpe?g|bmp)".toRegex() val jf = JFrame("WaterMarker") -object obs : Observable() { - fun observe() { - setChanged() - } -} fun main(args: Array) { var watermark: File? = null @@ -127,7 +122,7 @@ fun main(args: Array) { fun doTheThing(basedir: File, outdir: File, watermarkpath: File) { val watermark = ImageIO.read(watermarkpath) //JOptionPane.showMessageDialog(jf, "", "Inserting watermark!", JOptionPane.INFORMATION_MESSAGE, ImageIcon(watermark)) - FrmPopUpInfo("Inserting Watermark", watermark) + //FrmPopUpInfo("Inserting Watermark", watermark) for (f in basedir.listFiles()) { if (filenameRegex.matches(f.name.toString()) && !"jpe?g".toRegex().matches(f.extension)) { val image = ImageIO.read(f) @@ -158,8 +153,6 @@ fun doTheThing(basedir: File, outdir: File, watermarkpath: File) { writer.dispose() } } - obs.observe() - obs.notifyObservers() } fun Component.forceToCenter(): Component = JPanel().apply { this.add(this@forceToCenter) } @@ -174,23 +167,23 @@ fun addWM(watermark: BufferedImage, image: BufferedImage): Image { return combined } -class FrmPopUpInfo(message: String, image: Image) : JFrame() { - init { - this.title = message - this.add(JLabel(ImageIcon(image))) - this.background = Color.WHITE - this.pack() - - this.setLocationRelativeTo(null) - obs.addObserver { o, arg -> - java.util.Timer().schedule(timerTask { - - }, 5 * 1000) - this@FrmPopUpInfo.isVisible = false - - this@FrmPopUpInfo.dispose() - } - - this.isVisible = true - } -} \ No newline at end of file +//class FrmPopUpInfo(message: String, image: Image) : JFrame() { +// init { +// this.title = message +// this.add(JLabel(ImageIcon(image))) +// this.background = Color.WHITE +// this.pack() +// +// this.setLocationRelativeTo(null) +// obs.addObserver { _, _ -> +// java.util.Timer().schedule(timerTask { +// +// }, 5 * 1000) +// this@FrmPopUpInfo.isVisible = false +// +// this@FrmPopUpInfo.dispose() +// } +// +// this.isVisible = true +// } +//}