changeset 6:0640efd6b54a

Tweak borders (incomplete).
author David Barts <n5jrn@me.com>
date Sun, 19 Jan 2020 10:53:38 -0800
parents d832c7b2bfd0
children fbb3a6999590
files src/name/blackcap/clipman/Main.kt
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Main.kt	Sat Jan 18 12:55:26 2020 -0800
+++ b/src/name/blackcap/clipman/Main.kt	Sun Jan 19 10:53:38 2020 -0800
@@ -38,6 +38,7 @@
     // and the one we do
     override fun windowClosing(e: WindowEvent) {
         thr.run { interrupt(); join() }
+        LOGGER.log(Level.INFO, "execution complete")
         System.exit(0)
     }
 }
@@ -46,7 +47,7 @@
 class UpdateIt(val queue: PasteboardQueue, val interval: Int): Thread() {
     @Volatile var enabled = true
     private val stdBorder =
-        CompoundBorder(EmptyBorder(5, 10, 5, 10), LineBorder(Color.GRAY, 1))
+        CompoundBorder(LineBorder(Color(0xeeeeee), 9), LineBorder(Color.GRAY, 1))
 
     override fun run() {
         var oldContents = ""
@@ -108,18 +109,21 @@
 
 fun main(args: Array<String>) {
     LOGGER.log(Level.INFO, "beginning execution")
+    val frame = JFrame("ClipMan").apply { preferredSize = Dimension(640, 480) }
     val con = JPanel().apply {
         layout = BoxLayout(this, BoxLayout.Y_AXIS)
+        border = EmptyBorder(9, 9, 9, 9)
+        background = frame.background
     }
-    var frame: JFrame? = null
     inSwingThread {
-        frame = JFrame("ClipMan").apply {
-            preferredSize = Dimension(640, 480)
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        frame.apply {
             contentPane.add(
                 JScrollPane(con).apply {
                     verticalScrollBarPolicy = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
                     horizontalScrollBarPolicy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
                     preferredSize = Dimension(640, 480)
+                    background = frame.background
                 }, BorderLayout.CENTER)
             pack()
             setVisible(true)
@@ -127,8 +131,7 @@
     }
     val queue = PasteboardQueue(con, 10)
     val updater = UpdateIt(queue, 1000).apply { start() }
-    inSwingThread { frame?.addWindowListener(KillIt(updater)) }
-    LOGGER.log(Level.INFO, "execution complete")
+    inSwingThread { frame.addWindowListener(KillIt(updater)) }
 }
 
 fun inSwingThread(block: () -> Unit) {