How do you change the font of a JLabel?

What will be an ideal response?

To give a JLabel object a new font, you can create a Font object, as in the following:
Font headlineFont = new Font("Monospaced", Font.BOLD, 36);

The typeface name is a String, so you must enclose it in double quotation marks when you use it to declare the Font object. Then you use the setFont() method to assign the Font to a JLabel with a statement such as:
greeting.setFont(headlineFont);

Computer Science & Information Technology

You might also like to view...

Creating a business Twitter account costs a certain amount as it allows businesses to instantly connect and engage with its customers.?

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which statement about CGI scripts is false?

A. You can use CGI scripts to start and stop external programs or to specify that a page updated automatically based on user input. B. You can use CGI scripts to create surveys and site search tools, but they are not appropriate for creating games. C. CGI lets you create dynamic web documents "on the fly" so that pages can be generated in response to preferences specified by the user. D. You can use CGI to do basic tasks such as record entries to a guest book or count the number of people who have accessed a specific page of your site.

Computer Science & Information Technology