1 | sclass HighlightCaret extends DefaultCaret {
|
2 | Highlighter.HighlightPainter unfocusedPainter = new DefaultHighlighter.DefaultHighlightPainter(Color.LIGHT_GRAY); |
3 | Highlighter.HighlightPainter focusedPainter = null; //new DefaultHighlighter.DefaultHighlightPainter(Color.LIGHT_GRAY); |
4 | bool isFocused; |
5 | |
6 | @Override |
7 | protected Highlighter.HighlightPainter getSelectionPainter() {
|
8 | setBlinkRate(500); // otherwise is disabled, stopped |
9 | return isFocused ? (focusedPainter != null ? focusedPainter : super.getSelectionPainter()) : unfocusedPainter; |
10 | } |
11 | |
12 | @Override |
13 | public void setSelectionVisible(boolean hasFocus) {
|
14 | if (hasFocus != isFocused) {
|
15 | isFocused = hasFocus; |
16 | super.setSelectionVisible(false); |
17 | super.setSelectionVisible(true); |
18 | } |
19 | } |
20 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1008679 |
| Snippet name: | HighlightCaret |
| Eternal ID of this version: | #1008679/8 |
| Text MD5: | 72854c7ec27ab064a6887d8e769255aa |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-05-28 07:28:30 |
| Source code size: | 798 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 699 / 1294 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |