JFrame

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

import javax.swing.

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

public class Main {

public static void main(String[] args) {

JFrame frm1 = new JFrame ("Main Form");


JLabel lblNAME = new JLabel ("Name:", JLabel.CENTER);
JTextField txtName = new JTextField(15);
JLabel lblAge = new JLabel ("Age:", JLabel. CENTER);
JTextField txtAge = new JTextField(15);
JLabel lblAddress = new JLabel ("Address:", JLabel. CENTER);
JTextField txtAddress = new JTextField(15);
JLabel lblUserName = new JLabel ("UserName:", JLabel. CENTER);
JTextField txtUserName = new JTextField(15);
JLabel lblPassword = new JLabel ("Password:", JLabel. CENTER);
JTextField txtPassword = new JTextField(15);
JButton btnSave = new JButton ("Save");

frm1.setLayout(new FlowLayout());

frm1.add(lblNAME);
frm1.add(txtName);
frm1.add(lblAge);
frm1.add(txtAge);
frm1.add(lblAddress);
frm1.add(txtAddress);
frm1.add(lblUserName);
frm1.add(txtUserName);
frm1.add(lblPassword);
frm1.add(txtPassword);
frm1.add(btnSave);
frm1.setSize(250, 350);
frm1.setVisible(true);
frm1.setLocation(100, 100);
frm1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm1.setResizable(false);
}

You might also like