I refer to this link to Nimbus .
I tried to set the global font a bit more:
UIManager.put("defaultFont", new Font(Font.SANS_SERIF, 0, 16));
... only works for menus, but nothing else (buttons, labels).
I tried changing the shortcuts and buttons with
UIManager.put("Button.font", new Font(Font.SANS_SERIF, 0, 16)); UIManager.put("Label.font", new Font(Font.SANS_SERIF, 0, 16));
but the font remains .
The only thing that worked for me was the font output :
someButton.setFont(someButton.getFont().deriveFont(16f));
But this is not an option, since it needs to be done manually for each element.
Note that getting a font for UIManager does not work :
UIManager.put("Label.font", UIManager.getFont("Label.font").deriveFont(16f));
I tested everything under Linux and Windows: the same behavior.
I just don’t understand how the API can be so confusing. If the setFont (..) method is called, then I expect it to set the font. If this method does not install the font in any imaginable circumstances, then it should be obsolete.
EDIT:
The problem is not only applicable to Nimbus, but also to LAF by default.
java user-interface fonts swing nimbus
ivan_ivanovich_ivanoff
source share