The following will do the trick:
pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
(Note that JTextPane continues with JEditorPane .)
Update (August 2016):
So that you can survive. Look, feel and change the system (for example, fonts changed in the Windows control panel), here you can place the line:
@Override public void updateUI() { super.updateUI(); putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); }
(This is also called at build time.)
Luke usherwood
source share