SyntaxFix
Write A Post
Hire A Developer
Questions
Tags
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 JLabel and JButton. How can I do that?
JLabel
JButton
This question is related to java fonts
java
fonts
Font myFont = new Font("Serif", Font.BOLD, 12);, then use a setFont method on your components like
Font myFont = new Font("Serif", Font.BOLD, 12);
JButton b = new JButton("Hello World"); b.setFont(myFont);
Source: Stackoverflow.com