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

8
LINES

< > BotCompany Repo | #1009427 // setCaretPosition - wrapper for JTextComponent.setCaretPosition with pcall

JavaX fragment (include)

svoid setCaretPosition(final JTextComponent c, final int pos) {
  if (c != null) swing {
    pcall {
      int _pos = max(0, min(l(c.getText()), pos));
      c.setCaretPosition(_pos);
    }
  }
}

Author comment

Began life as a copy of #1006445

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009427
Snippet name: setCaretPosition - wrapper for JTextComponent.setCaretPosition with pcall
Eternal ID of this version: #1009427/6
Text MD5: 640d7c896300a76cfc8c1751cb60573f
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-18 17:19:01
Source code size: 202 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 472 / 546
Version history: 5 change(s)
Referenced in: [show references]