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...

_________ would appear to be the most secure of the three Diffie-Hellman options because it results in a temporary, authenticated key. ?

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The command-line command to instruct the ping utility to send packets until explicitly told to stop is ping ____

a. -s b. -t c. -u d. None of the above

Computer Science & Information Technology

Given the function prototype:float test(int, int, int);which of the following statements is legal?

A. cout << test(7, test(14, 23)); B. cout << test(test(7, 14), 23); C. cout << test(14, 23); D. cout << test(7, 14, 23);

Computer Science & Information Technology

Objects on a form cannot be referenced from any other form.

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

Computer Science & Information Technology