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

20
LINES

< > BotCompany Repo | #1019124 // dm_moduleSelectorComboBox

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4930L/32K).

static JComboBox dm_moduleSelectorComboBox(SimpleLiveValue<S> lvModuleIDAndName) {
  final JComboBox cb = jLiveValueComboBox(emptyStringPlus(dm_listModuleIDsAndNames()), lvModuleIDAndName);
  final ReliableSingleThread update = new(r {
    S selected = squareBracketStuff(selectedItem(cb));
    LS l = emptyStringPlus(dm_listModuleIDsAndNames());
    
    swing {  
      // TODO: change items while keeping popup open
      if (!cb.isPopupVisible() || !moduleSelector_sameList(getComboBoxItems(cb), l))
        setComboBoxItems(cb, l);
      setSelectedIndex(cb, indexOfStringWithSquareBracketStuffEq(l, selected));
    }
  });
  final new Var<AutoCloseable> listener;
  bindToComponent(cb, r {
    listener.set(vmBus_onModulesListChange(update));
  }, r { close(listener!) });
  awtEvery(cb, 60.0, update); // to make up for TODO up there
  ret cb;
}

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: 379 / 511
Version history: 16 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1019776 - dm_onlineComputerSelectorComboBox [dev.]
#1020179 - dm_moduleSelectorComboBox_justID