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

10
LINES

< > BotCompany Repo | #1034347 // getMenuItems

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

Libraryless. Click here for Pure Java version (8149L/45K).

static L<JMenuItem> getMenuItems(JMenu menu) {
  if (menu == null) null;
  ret nonNulls(countIterator(menu.getItemCount(), i -> menu.getItem(i)));
}

// seems we have to emulate this for JPopupMenu
static L<JMenuItem> getMenuItems(JPopupMenu menu) {
  if (menu == null) null;
  ret instancesOf JMenuItem(asList(menu.getSubElements()));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034347
Snippet name: getMenuItems
Eternal ID of this version: #1034347/4
Text MD5: 2aa6fe0c64c3bb18d8d63f60ae1ccddb
Transpilation MD5: 5cc963623e90117ba0ef5d6b783557c5
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-30 14:18:51
Source code size: 346 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 141 / 233
Version history: 3 change(s)
Referenced in: [show references]