Change Font of JTextField - Java Swing

Java examples for Swing:JTextField

Description

Change Font of JTextField

Demo Code


import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JApplet;
import javax.swing.JTextField;
 
public class Main {
       /*w  ww .  jav a 2s  .  c om*/
        public void init(){
                JTextField field = new JTextField("JTextField Change Font Example",30);
                Font font = new Font("Courier", Font.BOLD,12);
                field.setFont(font);
        }
}

Related Tutorials