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).

1  
static L<JMenuItem> getMenuItems(JMenu menu) {
2  
  if (menu == null) null;
3  
  ret nonNulls(countIterator(menu.getItemCount(), i -> menu.getItem(i)));
4  
}
5  
6  
// seems we have to emulate this for JPopupMenu
7  
static L<JMenuItem> getMenuItems(JPopupMenu menu) {
8  
  if (menu == null) null;
9  
  ret instancesOf JMenuItem(asList(menu.getSubElements()));
10  
}

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: 143 / 236
Version history: 3 change(s)
Referenced in: [show references]