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

13
LINES

< > BotCompany Repo | #1015211 // selectItem - for JComboBox or JList

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

Libraryless. Click here for Pure Java version (2983L/18K).

static <A> JComboBox<A> selectItem(A item, JComboBox<A> cb) {
  if (cb != null) swing { cb.setSelectedItem(item); }
  ret cb;
}

static <A> JComboBox<A> selectItem(JComboBox<A> cb, A item) {
  ret selectItem(item, cb);
}

static <A> JList<A> selectItem(JList<A> list, A item) {
  swing { selectRow(list, jlist_indexOf(list, item)); }
  ret list;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015211
Snippet name: selectItem - for JComboBox or JList
Eternal ID of this version: #1015211/6
Text MD5: 8b3f6e69cb982fb4de9ef2ac138c52a7
Transpilation MD5: 42d4993a6c5e3ddfc839cc762ccdcb36
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-26 15:10:26
Source code size: 359 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 394 / 623
Version history: 5 change(s)
Referenced in: [show references]