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

14
LINES

< > TinyBrain | #1007197 - setFontSize

JavaX fragment (include)

static <A extends JComponent> A setFontSize(final float size, final A a) {
  if (a == null) ret a;
  swing {
    Component _a = a;
    if (a instanceof JComboBox)
      _a = ((JComboBox) a).getEditor().getEditorComponent();
    _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   

Travelled to 4 computer(s): cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, tvejysmllsmz

No comments. add comment

Snippet ID: #1007197
Snippet name: setFontSize
Eternal ID of this version: #1007197/11
Text MD5: cf8a1892bc859a931acd97ef8ce9d8dc
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-10 19:47:03
Source code size: 400 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 141 / 143
Version history: 10 change(s)
Referenced in: [show]