Update Main
This commit is contained in:
parent
e771a75512
commit
b300c3c114
|
@ -22,11 +22,6 @@ val filenameRegex = ".*\\.(png|jpe?g|bmp)".toRegex()
|
||||||
|
|
||||||
val jf = JFrame("WaterMarker")
|
val jf = JFrame("WaterMarker")
|
||||||
|
|
||||||
object obs : Observable() {
|
|
||||||
fun observe() {
|
|
||||||
setChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
var watermark: File? = null
|
var watermark: File? = null
|
||||||
|
@ -127,7 +122,7 @@ fun main(args: Array<String>) {
|
||||||
fun doTheThing(basedir: File, outdir: File, watermarkpath: File) {
|
fun doTheThing(basedir: File, outdir: File, watermarkpath: File) {
|
||||||
val watermark = ImageIO.read(watermarkpath)
|
val watermark = ImageIO.read(watermarkpath)
|
||||||
//JOptionPane.showMessageDialog(jf, "", "Inserting watermark!", JOptionPane.INFORMATION_MESSAGE, ImageIcon(watermark))
|
//JOptionPane.showMessageDialog(jf, "", "Inserting watermark!", JOptionPane.INFORMATION_MESSAGE, ImageIcon(watermark))
|
||||||
FrmPopUpInfo("Inserting Watermark", watermark)
|
//FrmPopUpInfo("Inserting Watermark", watermark)
|
||||||
for (f in basedir.listFiles()) {
|
for (f in basedir.listFiles()) {
|
||||||
if (filenameRegex.matches(f.name.toString()) && !"jpe?g".toRegex().matches(f.extension)) {
|
if (filenameRegex.matches(f.name.toString()) && !"jpe?g".toRegex().matches(f.extension)) {
|
||||||
val image = ImageIO.read(f)
|
val image = ImageIO.read(f)
|
||||||
|
@ -158,8 +153,6 @@ fun doTheThing(basedir: File, outdir: File, watermarkpath: File) {
|
||||||
writer.dispose()
|
writer.dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
obs.observe()
|
|
||||||
obs.notifyObservers()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Component.forceToCenter(): Component = JPanel().apply { this.add(this@forceToCenter) }
|
fun Component.forceToCenter(): Component = JPanel().apply { this.add(this@forceToCenter) }
|
||||||
|
@ -174,23 +167,23 @@ fun addWM(watermark: BufferedImage, image: BufferedImage): Image {
|
||||||
return combined
|
return combined
|
||||||
}
|
}
|
||||||
|
|
||||||
class FrmPopUpInfo(message: String, image: Image) : JFrame() {
|
//class FrmPopUpInfo(message: String, image: Image) : JFrame() {
|
||||||
init {
|
// init {
|
||||||
this.title = message
|
// this.title = message
|
||||||
this.add(JLabel(ImageIcon(image)))
|
// this.add(JLabel(ImageIcon(image)))
|
||||||
this.background = Color.WHITE
|
// this.background = Color.WHITE
|
||||||
this.pack()
|
// this.pack()
|
||||||
|
//
|
||||||
this.setLocationRelativeTo(null)
|
// this.setLocationRelativeTo(null)
|
||||||
obs.addObserver { o, arg ->
|
// obs.addObserver { _, _ ->
|
||||||
java.util.Timer().schedule(timerTask {
|
// java.util.Timer().schedule(timerTask {
|
||||||
|
//
|
||||||
}, 5 * 1000)
|
// }, 5 * 1000)
|
||||||
this@FrmPopUpInfo.isVisible = false
|
// this@FrmPopUpInfo.isVisible = false
|
||||||
|
//
|
||||||
this@FrmPopUpInfo.dispose()
|
// this@FrmPopUpInfo.dispose()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
this.isVisible = true
|
// this.isVisible = true
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
Loading…
Reference in a new issue