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

14
LINES

< > BotCompany Repo | #1006615 - jcomboboxFromConcepts

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

Libraryless. Click here for Pure Java version (12821L/87K).

// field: field to use for display
static JComboBox jcomboboxFromConcepts(Class<? extends Concept> cc, S field) {
  ret jcomboboxFromConcepts(mainConcepts, cc, field);
}

static JComboBox jcomboboxFromConcepts(Concepts concepts, Class<? extends Concept> cc, S field) {
  L<S> items = ll("");
  for (Concept c : list(concepts, cc)) {
    S name = "";
    pcall { if (nempty(field)) name = str(cget(c, field)); }
    items.add(c.id + addPrefixIfNotEmpty(" - ", name));
  }
  ret jcombobox(items);
}

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1006615
Snippet name: jcomboboxFromConcepts
Eternal ID of this version: #1006615/2
Text MD5: c1ea5b94f000d7ce3fbd4e53b7b019f9
Transpilation MD5: 6cbd4d794f7f5b4096adb308f6b87899
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-06 23:48:10
Source code size: 509 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 355 / 345
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1006615 & http://1006615.tinybrain.de