# HG changeset patch # User David Barts # Date 1579466802 28800 # Node ID fbb3a699959066b1f4fcc035f009e4bf4aedb4da # Parent 0640efd6b54a746b302521902cd124a805c3e57c More border tweaks, etc. diff -r 0640efd6b54a -r fbb3a6999590 src/name/blackcap/clipman/Main.kt --- 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) { 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)) }