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

7
LINES

< > BotCompany Repo | #1030813 // getSelectedItem_typed - for JList/JComboBox

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

Libraryless. Click here for Pure Java version (2906L/17K).

1  
static <A> A getSelectedItem_typed(JList<A> l) {
2  
  ret swing(() -> l.getSelectedValue());
3  
}
4  
5  
static <A> A getSelectedItem_typed(JComboBox<A> cb) {
6  
  ret swing(() -> (A) cb.getSelectedItem());
7  
}

Author comment

Began life as a copy of #1004939

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030813
Snippet name: getSelectedItem_typed - for JList/JComboBox
Eternal ID of this version: #1030813/2
Text MD5: 6fc5addc9fdad70d7c8c92ae3ebd4f69
Transpilation MD5: 8c6b260090924b9ba861df0fe7187fc3
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-29 13:17:21
Source code size: 199 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 231 / 325
Version history: 1 change(s)
Referenced in: [show references]