I have a JTextPane, and I'm trying to get the default font size of the JTextPane.
I've tried looking for methods such as getFontSize()
and getTextSize()
, but none seem to exist. I'm clearly missing something, so can anyone help out with this?
I think you want:
int size = yourTextPane.getFont().getSize();
Or even more generic:
Font defaultFont = UIManager.getDefaults().getFont("TextPane.font");
int defaultSize = defaultFont.getSize();