comparison src/name/blackcap/clipman/PasteboardView.kt @ 28:f1fcc1281dad

Use BorderFactory; clean up Find dialog.
author David Barts <n5jrn@me.com>
date Wed, 29 Jan 2020 13:39:14 -0800
parents 8aa2dfac27eb
children c4f53bc01732
comparison
equal deleted inserted replaced
27:8aa2dfac27eb 28:f1fcc1281dad
4 package name.blackcap.clipman 4 package name.blackcap.clipman
5 5
6 import java.awt.Color 6 import java.awt.Color
7 import java.awt.Dimension 7 import java.awt.Dimension
8 import javax.swing.* 8 import javax.swing.*
9 import javax.swing.border.*
10 import javax.swing.text.html.StyleSheet 9 import javax.swing.text.html.StyleSheet
11 import javax.swing.text.html.HTMLEditorKit 10 import javax.swing.text.html.HTMLEditorKit
12 11
13 /* border widths */ 12 /* border widths */
14 val OUTER_BORDER_TOP = 3 13 val OUTER_BORDER_TOP = 3
18 17
19 /** 18 /**
20 * What we use to display the text that is or was in the clipboard. 19 * What we use to display the text that is or was in the clipboard.
21 */ 20 */
22 class ClipText: JTextPane() { 21 class ClipText: JTextPane() {
23 private val normalBorder = CompoundBorder(LineBorder(Color.GRAY, INNER_BORDER), 22 private val normalBorder = BorderFactory.createCompoundBorder(
24 EmptyBorder(MARGIN_BORDER, MARGIN_BORDER, MARGIN_BORDER, MARGIN_BORDER)) 23 BorderFactory.createLineBorder(Color.GRAY, INNER_BORDER),
25 private val selectedBorder = CompoundBorder(LineBorder(Color.BLACK, INNER_BORDER+1), 24 BorderFactory.createEmptyBorder(MARGIN_BORDER, MARGIN_BORDER, MARGIN_BORDER, MARGIN_BORDER))
26 EmptyBorder(MARGIN_BORDER-1, MARGIN_BORDER-1, MARGIN_BORDER-1, MARGIN_BORDER-1)) 25 private val selectedBorder = BorderFactory.createCompoundBorder(
26 BorderFactory.createLineBorder(Color.BLACK, INNER_BORDER+1),
27 BorderFactory.createEmptyBorder(MARGIN_BORDER-1, MARGIN_BORDER-1, MARGIN_BORDER-1, MARGIN_BORDER-1))
27 init { 28 init {
28 border = normalBorder 29 border = normalBorder
29 setEditable(false) 30 setEditable(false)
30 alignmentX = JTextPane.LEFT_ALIGNMENT 31 alignmentX = JTextPane.LEFT_ALIGNMENT
31 resize() 32 resize()
86 * Views are based on a JLabel and a ClipText (which we use for searching), 87 * Views are based on a JLabel and a ClipText (which we use for searching),
87 * wrapped in a JPanel that we use to display both. 88 * wrapped in a JPanel that we use to display both.
88 */ 89 */
89 class PasteboardItemView(label: String, val searchable: ClipText) { 90 class PasteboardItemView(label: String, val searchable: ClipText) {
90 private val outerBorder = 91 private val outerBorder =
91 MatteBorder(OUTER_BORDER_TOP, OUTER_BORDER, OUTER_BORDER, OUTER_BORDER, 92 BorderFactory.createMatteBorder(OUTER_BORDER_TOP, OUTER_BORDER, OUTER_BORDER, OUTER_BORDER,
92 queue.v.parent.background) 93 queue.v.parent.background)
93 94
94 val contents = JPanel().apply { 95 val contents = JPanel().apply {
95 layout = BoxLayout(this, BoxLayout.Y_AXIS) 96 layout = BoxLayout(this, BoxLayout.Y_AXIS)
96 background = queue.v.parent.background 97 background = queue.v.parent.background