Mercurial > cgi-bin > hgweb.cgi > ClipMan
comparison src/name/blackcap/clipman/Main.kt @ 20:17296054c103
HTMLEditorKit shares all stylesheets. How unbelievably braindamaged.
author | David Barts <n5jrn@me.com> |
---|---|
date | Tue, 21 Jan 2020 23:38:10 -0800 |
parents | 5e0d1fe61da9 |
children | c10a447b9e1b |
comparison
equal
deleted
inserted
replaced
19:5e0d1fe61da9 | 20:17296054c103 |
---|---|
64 class ClipText: JTextPane() { | 64 class ClipText: JTextPane() { |
65 override fun getMaximumSize(): Dimension { | 65 override fun getMaximumSize(): Dimension { |
66 return Dimension(Int.MAX_VALUE, preferredSize.height) | 66 return Dimension(Int.MAX_VALUE, preferredSize.height) |
67 } | 67 } |
68 } | 68 } |
69 | |
70 /* HTMLEditorKit shares all stylesheets. How unbelievably braindamaged. */ | |
71 class MyEditorKit: HTMLEditorKit() { | |
72 private var _styleSheet = defaultStyleSheet | |
73 override fun getStyleSheet() = _styleSheet | |
74 override fun setStyleSheet(value: StyleSheet) { | |
75 _styleSheet = value | |
76 } | |
77 | |
78 val defaultStyleSheet: StyleSheet | |
79 get() { | |
80 return super.getStyleSheet() | |
81 } | |
82 } | |
83 | |
69 | 84 |
70 /* the updating thread */ | 85 /* the updating thread */ |
71 class UpdateIt(val queue: PasteboardQueue, val interval: Int): Thread() { | 86 class UpdateIt(val queue: PasteboardQueue, val interval: Int): Thread() { |
72 @Volatile var enabled = true | 87 @Volatile var enabled = true |
73 private val outerBorder = | 88 private val outerBorder = |
109 } | 124 } |
110 } else { | 125 } else { |
111 widget.run { | 126 widget.run { |
112 add(stdLabel("Styled text")) | 127 add(stdLabel("Styled text")) |
113 val (dhtml, style) = preproc(html) | 128 val (dhtml, style) = preproc(html) |
114 val hek = HTMLEditorKit().apply { | 129 val hek = MyEditorKit().apply { |
115 style.addStyleSheet(styleSheet) | 130 style.addStyleSheet(defaultStyleSheet) |
116 styleSheet = style | 131 styleSheet = style |
117 } | 132 } |
118 add(ClipText().apply { | 133 add(ClipText().apply { |
119 editorKit = hek | 134 editorKit = hek |
120 text = dhtml | 135 text = dhtml |