JTextFieldTest.java Source code

Java tutorial

Introduction

Here is the source code for JTextFieldTest.java

Source

import javax.swing.*;
import java.awt.*;

public class JTextFieldTest extends JFrame {
    public JTextFieldTest() {
        super("JTextField Test");

        getContentPane().setLayout(new FlowLayout());

        JTextField textField1 = new JTextField("1", 1);
        JTextField textField2 = new JTextField("22", 2);
        JTextField textField3 = new JTextField("333", 3);

        getContentPane().add(textField1);
        getContentPane().add(textField2);
        getContentPane().add(textField3);

        setSize(300, 170);
        setVisible(true);
    }

    public static void main(String argv[]) {
        new JTextFieldTest();
    }
}