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

8
LINES

< > BotCompany Repo | #1030797 // customToStringListCellRenderer

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

Libraryless. Click here for Pure Java version (2725L/16K).

static <A> ListCellRenderer<A> lambdaMapLike customToStringListCellRenderer(IF1<A, S> toString) {
  ret (ListCellRenderer) new DefaultListCellRenderer {
    @Override
    public Component getListCellRendererComponent(JList list, O value, int index, bool isSelected, bool cellHasFocus) {
      ret super.getListCellRendererComponent(list, toString.get((A) value), index, isSelected, cellHasFocus);
    }
  };
}

Author comment

Began life as a copy of #1019092

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1030797
Snippet name: customToStringListCellRenderer
Eternal ID of this version: #1030797/7
Text MD5: b7027b1a18a1af4b7a4fcf788e8fc7e7
Transpilation MD5: 6058ece4d1b7f366901757ca3ad4cb15
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-26 15:34:37
Source code size: 416 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 206 / 320
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030814 - autoFontListCellRenderer - use component's font