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

20
LINES

< > BotCompany Repo | #1020179 // dm_moduleSelectorComboBox_justID

JavaX fragment (include)

1  
static JComboBox dm_moduleSelectorComboBox_justID(SimpleLiveValue<S> lvModuleID) {
2  
  final JComboBox cb = jLiveValueComboBox_withSimplifier(emptyStringPlus(dm_listModuleIDsAndNames()), lvModuleID, f firstIntAsString);
3  
  final Runnable update = r {
4  
    awt {
5  
      S selected = squareBracketStuff(selectedItem(cb));
6  
      LS l = emptyStringPlus(dm_listModuleIDsAndNames());
7  
      
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  
}

Author comment

Began life as a copy of #1019124

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020179
Snippet name: dm_moduleSelectorComboBox_justID
Eternal ID of this version: #1020179/1
Text MD5: e1e478721cb5fdccf08214172caa54f8
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-09 20:48:48
Source code size: 884 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 316 / 336
Referenced in: [show references]