Is there a way to make my string bold?
I have a string:
Now how can I make that bold?Code:String nameTitle = "Name: ";
Printable View
Is there a way to make my string bold?
I have a string:
Now how can I make that bold?Code:String nameTitle = "Name: ";
Strings are just that, strings. They don't have bold, font, or any other "properties". Now if you want to make a JLabel Bold, then that's different -- change the label's Font.
that's what i meant, thanks
You will find much help in the Java API and the Sun Swing Tutorials.
I recommend that you look at the JLabel API and the setFont(...) method. Then have a look at the Font API where you will see how to set the Font to bold. Then come on back if you still don't understand something there.
edit: If you aren't going to be setting anything more than the bold attribute, then have a look at deriveFont:
Code:myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
Will do, thanks!