Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1008679 // HighlightCaret

JavaX fragment (include)

sclass HighlightCaret extends DefaultCaret {
  Highlighter.HighlightPainter unfocusedPainter = new DefaultHighlighter.DefaultHighlightPainter(Color.LIGHT_GRAY);
  Highlighter.HighlightPainter focusedPainter = null; //new DefaultHighlighter.DefaultHighlightPainter(Color.LIGHT_GRAY);
  bool isFocused;

  @Override
  protected Highlighter.HighlightPainter getSelectionPainter() {
    setBlinkRate(500); // otherwise is disabled, stopped
    return isFocused ? (focusedPainter != null ? focusedPainter : super.getSelectionPainter()) : unfocusedPainter;
  }

  @Override
  public void setSelectionVisible(boolean hasFocus) {
    if (hasFocus != isFocused) {
        isFocused = hasFocus;
        super.setSelectionVisible(false);
        super.setSelectionVisible(true);
    }
  }
}

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: 501 / 1092
Version history: 7 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)