import javax.swing.plaf.basic.BasicComboBoxRenderer; static void setComboBoxListFontSize(final JComboBox cb, final int fontSize) swing { cb.setRenderer(new BasicComboBoxRenderer { new DefaultListCellRenderer defaultRenderer; public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel renderer = cast defaultRenderer.getListCellRendererComponent(list, value, index, isSelected,cellHasFocus); setFontSize(renderer, fontSize); ret renderer; } }); }
Began life as a copy of #1012966
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1012967 |
Snippet name: | setComboBoxListFontSize - only works with default renderer |
Eternal ID of this version: | #1012967/4 |
Text MD5: | 15ed59ebea8af2bd3b996d15ef1cb59d |
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:11:17 |
Source code size: | 568 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 424 / 452 |
Version history: | 3 change(s) |
Referenced in: | [show references] |