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

13
LINES

< > BotCompany Repo | #1030814 // autoFontListCellRenderer - use component's font

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

Libraryless. Click here for Pure Java version (3025L/18K).

static <A> ListCellRenderer<A> lambdaMapLike autoFontListCellRenderer(JComponent component) {
  ret (ListCellRenderer) new DefaultListCellRenderer {
    @Override
    public Component getListCellRendererComponent(JList list, O value, int index, bool isSelected, bool cellHasFocus) {
      Font font = main getFont(or(component, list));
      Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
      printVars_str autoFontListCellRenderer(+font);
      if (font != null && c instanceof JComponent) 
        c/JComponent.setFont(font);
      ret c;
    }
  };
}

Author comment

Began life as a copy of #1030797

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1030814
Snippet name: autoFontListCellRenderer - use component's font
Eternal ID of this version: #1030814/5
Text MD5: f2f4a4ff7cc98220c2be9df7de3fd32d
Transpilation MD5: 9d3a10e06ea97a1074f4c2c6e5bf6927
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 14:17:53
Source code size: 616 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 256
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)