Libraryless. Click here for Pure Java version (3025L/18K).
1 | static <A> ListCellRenderer<A> lambdaMapLike autoFontListCellRenderer(JComponent component) {
|
2 | ret (ListCellRenderer) new DefaultListCellRenderer {
|
3 | @Override |
4 | public Component getListCellRendererComponent(JList list, O value, int index, bool isSelected, bool cellHasFocus) {
|
5 | Font font = main getFont(or(component, list)); |
6 | Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
7 | printVars_str autoFontListCellRenderer(+font); |
8 | if (font != null && c instanceof JComponent) |
9 | c/JComponent.setFont(font); |
10 | ret c; |
11 | } |
12 | }; |
13 | } |
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: | 383 / 522 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |