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

13
LINES

< > BotCompany Repo | #1012967 // setComboBoxListFontSize - only works with default renderer

JavaX fragment (include)

1  
import javax.swing.plaf.basic.BasicComboBoxRenderer;
2  
3  
static void setComboBoxListFontSize(final JComboBox cb, final int fontSize) swing {
4  
  cb.setRenderer(new BasicComboBoxRenderer {
5  
    new DefaultListCellRenderer defaultRenderer;
6  
7  
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
8  
      JLabel renderer = cast defaultRenderer.getListCellRendererComponent(list, value, index, isSelected,cellHasFocus);
9  
      setFontSize(renderer, fontSize);
10  
      ret renderer;
11  
    }
12  
  });
13  
}

Author comment

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: 426 / 455
Version history: 3 change(s)
Referenced in: [show references]