You are on page 1of 2

import javax.swing.

*;
import java.awt.*;
import java.awt.event.*;

class Myframe extends JFrame implements ActionListener{

JLabel a,b,c;
JTextField t1,t2;
JRadioButton M,F;
JButton Submit;
JTextArea x;
JCheckBox terms;

Myframe(){
setTitle("Form fill page");
setSize(700,500);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);

Container Z=getContentPane();
Z.setLayout(null);

a=new JLabel("First name");


a.setBounds(20,50,100,20);
Z.add(a);

t1= new JTextField();


t1.setBounds(130,50,100,20);
Z.add(t1);

b=new JLabel("Last name");


b.setBounds(20,100,100,20);
Z.add(b);

t2= new JTextField();


t2.setBounds(130,100,100,20);
Z.add(t2);

c=new JLabel("Select your gender");


c.setBounds(20,150,200,20);
Z.add(c);

M=new JRadioButton("Male");
M.setBounds(150,150,80,20);
Z.add(M);

F=new JRadioButton("Female");
F.setBounds(240,150,80,20);
Z.add(F);

terms=new JCheckBox("Do you accept the terms and conditions?");


terms.setBounds(10,190,350,20);
Z.add(terms);

Submit=new JButton("Submit");
Submit.setBounds(110,220,100,20);
Z.add(Submit);

Submit.addActionListener(this);

x=new JTextArea();
x.setBounds(340,50,300,300);
Z.add(x);
setVisible(true);
}

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub

public class GUI {


public static void main (String args[]) {
Myframe frame= new Myframe();
}
}

You might also like