Libraryless. Click here for Pure Java version (4930L/32K).
1 | static JComboBox dm_moduleSelectorComboBox(SimpleLiveValue<S> lvModuleIDAndName) { |
2 | final JComboBox cb = jLiveValueComboBox(emptyStringPlus(dm_listModuleIDsAndNames()), lvModuleIDAndName); |
3 | final ReliableSingleThread update = new(r { |
4 | S selected = squareBracketStuff(selectedItem(cb)); |
5 | LS l = emptyStringPlus(dm_listModuleIDsAndNames()); |
6 | |
7 | swing { |
8 | // TODO: change items while keeping popup open |
9 | if (!cb.isPopupVisible() || !moduleSelector_sameList(getComboBoxItems(cb), l)) |
10 | setComboBoxItems(cb, l); |
11 | setSelectedIndex(cb, indexOfStringWithSquareBracketStuffEq(l, selected)); |
12 | } |
13 | }); |
14 | final new Var<AutoCloseable> listener; |
15 | bindToComponent(cb, r { |
16 | listener.set(vmBus_onModulesListChange(update)); |
17 | }, r { close(listener!) }); |
18 | awtEvery(cb, 60.0, update); // to make up for TODO up there |
19 | ret cb; |
20 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1019124 |
Snippet name: | dm_moduleSelectorComboBox |
Eternal ID of this version: | #1019124/17 |
Text MD5: | 5d71aaa8efceabe6b6752653988b6f8a |
Transpilation MD5: | 49789a7c5d592973f71c97504b2de72a |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-08-13 02:03:06 |
Source code size: | 871 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 378 / 510 |
Version history: | 16 change(s) |
Referenced in: | [show references] |