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

5
LINES

< > BotCompany Repo | #1016930 // selectAllOnFocusIf

JavaX fragment (include)

static <A extends JTextComponent> A selectAllOnFocusIf(final A tc, final F0<Bool> condition) {
  if (tc != null)
    onFocus(tc, r { if (isTrue(callF(condition))) awt { tc.selectAll() } }); // important to wait one AWT cycle
  ret tc;
}

Author comment

Began life as a copy of #1016903

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: #1016930
Snippet name: selectAllOnFocusIf
Eternal ID of this version: #1016930/2
Text MD5: 046454b9d94bed1793277b8e1150aac1
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-08 15:39:33
Source code size: 240 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 463 / 487
Version history: 1 change(s)
Referenced in: [show references]