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)

1  
svoid setCaretPosition(final JTextComponent c, final int pos) {
2  
  if (c != null) swing {
3  
    pcall {
4  
      int _pos = max(0, min(l(c.getText()), pos));
5  
      c.setCaretPosition(_pos);
6  
    }
7  
  }
8  
}

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: 546 / 620
Version history: 5 change(s)
Referenced in: [show references]