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)

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

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: 235 / 256
Referenced in: [show references]