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

12
LINES

< > BotCompany Repo | #1020349 // TextChangingListCellRenderer

JavaX fragment (include)

1  
sclass TextChangingListCellRenderer extends DefaultListCellRenderer {
2  
  O f; // func(S) -> S
3  
  
4  
  *(O *f) {}
5  
6  
  public Component getListCellRendererComponent(JList list, O value, int index, bool isSelected, bool cellHasFocus) {
7  
    Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
8  
    S s = strOrEmpty(value);
9  
    setText(f == null ? value : str(callF(f, s)));
10  
    ret c;
11  
  }
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020349
Snippet name: TextChangingListCellRenderer
Eternal ID of this version: #1020349/2
Text MD5: 2c9d05ae8d957ef0fcb6146a0c2089d5
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-15 02:30:12
Source code size: 437 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 303 / 826
Version history: 1 change(s)
Referenced in: [show references]