changeset 7:fbb3a6999590

More border tweaks, etc.
author David Barts <n5jrn@me.com>
date Sun, 19 Jan 2020 12:46:42 -0800
parents 0640efd6b54a
children 7715ff59f053
files src/name/blackcap/clipman/Main.kt
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Main.kt	Sun Jan 19 10:53:38 2020 -0800
+++ b/src/name/blackcap/clipman/Main.kt	Sun Jan 19 12:46:42 2020 -0800
@@ -24,6 +24,8 @@
 import org.jsoup.Jsoup
 import org.jsoup.nodes.*
 
+/* name we call ourselves */
+val MYNAME = "ClipMan"
 
 /* kills the updating thread (and does a system exit) when needed */
 class KillIt(val thr: Thread) : WindowListener {
@@ -47,7 +49,8 @@
 class UpdateIt(val queue: PasteboardQueue, val interval: Int): Thread() {
     @Volatile var enabled = true
     private val stdBorder =
-        CompoundBorder(LineBorder(Color(0xeeeeee), 9), LineBorder(Color.GRAY, 1))
+        CompoundBorder(LineBorder(queue.parent.background, 9),
+            CompoundBorder(LineBorder(Color.GRAY, 1), EmptyBorder(3, 3, 3, 3)))
 
     override fun run() {
         var oldContents = ""
@@ -109,14 +112,14 @@
 
 fun main(args: Array<String>) {
     LOGGER.log(Level.INFO, "beginning execution")
-    val frame = JFrame("ClipMan").apply { preferredSize = Dimension(640, 480) }
+    setLookFeel()
+    val frame = JFrame(MYNAME).apply { preferredSize = Dimension(640, 480) }
     val con = JPanel().apply {
         layout = BoxLayout(this, BoxLayout.Y_AXIS)
         border = EmptyBorder(9, 9, 9, 9)
         background = frame.background
     }
     inSwingThread {
-        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         frame.apply {
             contentPane.add(
                 JScrollPane(con).apply {
@@ -134,6 +137,12 @@
     inSwingThread { frame.addWindowListener(KillIt(updater)) }
 }
 
+fun setLookFeel() {
+    inSwingThread {
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+    }
+}
+
 fun inSwingThread(block: () -> Unit) {
     SwingUtilities.invokeLater(Runnable(block))
 }