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

9
LINES

< > BotCompany Repo | #1034139 // ListCellRendererWithToolTip

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

Libraryless. Click here for Pure Java version (4736L/26K).

srecord noeq ListCellRendererWithToolTip<A>(IF1<A, S> makeToolTip, ListCellRenderer<A> baseRenderer) is ListCellRenderer<A> {
  public Component getListCellRendererComponent(JList list, A value, int index, bool isSelected, bool cellHasFocus) {
    var c = baseRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    if (c cast JComponent) pcall {
      c.setToolTipText(makeToolTip?.get((A) value));
    }
    ret c;
  }
}

Author comment

Began life as a copy of #1034138

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034139
Snippet name: ListCellRendererWithToolTip
Eternal ID of this version: #1034139/4
Text MD5: 27a2818069bd80c8216acd02ab37c311
Transpilation MD5: 6058ebe476b46756cf3070b6c28deba4
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-24 15:39:26
Source code size: 465 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 77 / 140
Version history: 3 change(s)
Referenced in: [show references]