Mercurial > cgi-bin > hgweb.cgi > ClipMan
comparison src/name/blackcap/clipman/Main.kt @ 11:5bbb436fbcf7
Fix the glitch of the JTextPane's sometimes being too tall.
author | David Barts <n5jrn@me.com> |
---|---|
date | Sun, 19 Jan 2020 19:39:52 -0800 |
parents | e7e067f5b649 |
children | 0fb6da371b80 |
comparison
equal
deleted
inserted
replaced
10:e7e067f5b649 | 11:5bbb436fbcf7 |
---|---|
50 // and the one we do | 50 // and the one we do |
51 override fun windowClosing(e: WindowEvent) { | 51 override fun windowClosing(e: WindowEvent) { |
52 thr.run { interrupt(); join() } | 52 thr.run { interrupt(); join() } |
53 LOGGER.log(Level.INFO, "execution complete") | 53 LOGGER.log(Level.INFO, "execution complete") |
54 System.exit(0) | 54 System.exit(0) |
55 } | |
56 } | |
57 | |
58 class ClipText: JTextPane() { | |
59 override fun getMaximumSize(): Dimension { | |
60 return Dimension(Int.MAX_VALUE, preferredSize.height) | |
55 } | 61 } |
56 } | 62 } |
57 | 63 |
58 /* the updating thread */ | 64 /* the updating thread */ |
59 class UpdateIt(val queue: PasteboardQueue, val interval: Int): Thread() { | 65 class UpdateIt(val queue: PasteboardQueue, val interval: Int): Thread() { |
87 border = outerBorder | 93 border = outerBorder |
88 } | 94 } |
89 when (contents) { | 95 when (contents) { |
90 is PasteboardItem.Plain -> widget.run { | 96 is PasteboardItem.Plain -> widget.run { |
91 add(stdLabel("Plain text")) | 97 add(stdLabel("Plain text")) |
92 add(JTextPane().apply { | 98 add(ClipText().apply { |
93 contentType = "text/plain" | 99 contentType = "text/plain" |
94 text = contents.plain | 100 text = contents.plain |
95 font = Font(Font.MONOSPACED, Font.PLAIN, 14) | 101 font = Font(Font.MONOSPACED, Font.PLAIN, 14) |
96 border = stdBorder | 102 border = stdBorder |
97 autoSize(stdWidth!!) | 103 autoSize(stdWidth!!) |
99 alignmentX = JTextPane.LEFT_ALIGNMENT | 105 alignmentX = JTextPane.LEFT_ALIGNMENT |
100 }) | 106 }) |
101 } | 107 } |
102 is PasteboardItem.HTML -> widget.run { | 108 is PasteboardItem.HTML -> widget.run { |
103 add(stdLabel("Styled text")) | 109 add(stdLabel("Styled text")) |
104 add(JTextPane().apply { | 110 add(ClipText().apply { |
105 contentType = "text/html" | 111 contentType = "text/html" |
106 toolTipText = "Styled text" | 112 toolTipText = "Styled text" |
107 text = scrub(contents.html) | 113 text = scrub(contents.html) |
108 border = stdBorder | 114 border = stdBorder |
109 autoSize(stdWidth!!) | 115 autoSize(stdWidth!!) |