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).

static <A extends JComponent> A setFontSize(final float size, final A a) {
  if (a == null) ret a;
  swing {
    a.setFont(a.getFont().deriveFont((float) size));
    if (a cast JComboBox) {
      Component _a = a.getEditor().getEditorComponent();
      if (_a cast JComponent)
        _a.setFont(_a.getFont().deriveFont((float) size));
    }
  }
  ret a;
}

static <A extends JComponent> A setFontSize(A a, float size) {
  ret setFontSize(size, a);
}

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: 1170 / 1259
Version history: 13 change(s)
Referenced in: [show references]