sclass AutoCompleter { void addValue(S s) {} S completeInput(S s) { ret ""; } } sclass LocalAutoCompleter { new TreeSet<S> entries; void addValue(S s) { entries.add(s); } S completeInput(S s) { S completion = firstStartingWith(entries, s); ret completion != null ? dropPrefix(s, completion) : ""; } } static JTextField autoCompleteTextField(JTextField tf) { final new LocalAutoCompleter completer; onEnter(tf, r { completer.addValue(tf.getText()); }); /*onComponentHide(tf, r { completer.addValue(); );*/ }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006588 |
Snippet name: | autoCompleteTextField [dev.] |
Eternal ID of this version: | #1006588/1 |
Text MD5: | e3fc20d29bbf661cf244727b1a2d8ae7 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-01-20 16:01:16 |
Source code size: | 576 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 523 / 555 |
Referenced in: | [show references] |