How to change the size of the font of a JLabel to take the maximum size

g123k picture g123k · Apr 26, 2010 · Viewed 321.2k times · Source

I have a JLabel in a Container. The defaut size of the font is very small. I would like that the text of the JLabel to take the maximum size.

How can I do that?

Answer

Asaf David picture Asaf David · Apr 26, 2010
label = new JLabel("A label");
label.setFont(new Font("Serif", Font.PLAIN, 14));

taken from How to Use HTML in Swing Components