Answers for "JLabel font"

3

how to change font size in JLabel

label = new JLabel("A label");
label.setFont(new Font("Serif", Font.PLAIN, 14));
Posted by: Guest on October-23-2020
0

JLabel font

import java.awt.Font;
import javax.swing.*;
public class SwingDemo {
   public static void main(String args[]) {
      JFrame frame = new JFrame("Label Example");
      JLabel label;
      label = new JLabel("First Label");
      label.setBounds(50, 50, 100, 30);
      label.setFont(new Font("Verdana", Font.PLAIN, 18));
      frame.add(label);
      frame.setSize(300,300);
      frame.setLayout(null);
      frame.setVisible(true);
   }
}
Posted by: Guest on May-21-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language