Suppose I have a String, "Hello World". I want to change the style of this string to a BOLD font, and set the size of all the characters from 12 to 18 [pt]. After that I want to use this string in a
JComponent has a setFont() method. You will control the font there, not on the String.
JButton b = new JButton(); b.setFont(b.getFont().deriveFont(18.0f));