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

12
LINES

< > BotCompany Repo | #1020349 // TextChangingListCellRenderer

JavaX fragment (include)

sclass TextChangingListCellRenderer extends DefaultListCellRenderer {
  O f; // func(S) -> S
  
  *(O *f) {}

  public Component getListCellRendererComponent(JList list, O value, int index, bool isSelected, bool cellHasFocus) {
    Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    S s = strOrEmpty(value);
    setText(f == null ? value : str(callF(f, s)));
    ret c;
  }
}

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: 230 / 750
Version history: 1 change(s)
Referenced in: [show references]