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

16
LINES

< > BotCompany Repo | #1007197 // setFontSize

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

Libraryless. Click here for Pure Java version (2916L/17K).

1  
static <A extends JComponent> A setFontSize(final float size, final A a) {
2  
  if (a == null) ret a;
3  
  swing {
4  
    a.setFont(a.getFont().deriveFont((float) size));
5  
    if (a cast JComboBox) {
6  
      Component _a = a.getEditor().getEditorComponent();
7  
      if (_a cast JComponent)
8  
        _a.setFont(_a.getFont().deriveFont((float) size));
9  
    }
10  
  }
11  
  ret a;
12  
}
13  
14  
static <A extends JComponent> A setFontSize(A a, float size) {
15  
  ret setFontSize(size, a);
16  
}

Author comment

JComboBox needs special handling

Began life as a copy of #1007147

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: #1007197
Snippet name: setFontSize
Eternal ID of this version: #1007197/14
Text MD5: 73752a430b433b70254954d55ef594f1
Transpilation MD5: eaac87a6c1794bef9041bf3168dd6f25
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:22:18
Source code size: 465 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 1033 / 1089
Version history: 13 change(s)
Referenced in: [show references]