JAVA MAKE REGISTRATION FORM
JAVA . REGESTRATION FORM
////////////////////////////////////////////////////////////////////////////////////////
This is java registration form using swing
Input : Name
Input : Mob
Select Dob.
Check Accept
Submit
///////////////////////////////////////////////////////////////////////////////////////
import javax.swing.*;
import java.awt.*;
class MyFrame extends JFrame {
JLabel label1, label2, label3, label4,label5;
JTextField t1, t2;
JRadioButton male, female, other;
JComboBox<String> daysComboBox, monthsComboBox, yearsComboBox;
JTextArea tal;
JCheckBox terms;
JButton submit;
JLabel msg;
MyFrame()
{
setTitle("Registration Form");
setSize(700, 500);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(null);
label1 = new JLabel("Name");
label1.setBounds(20, 50, 100, 20);
c.add(label1);
t1 = new JTextField();
t1.setBounds(130, 50, 100, 20);
c.add(t1);
label2 = new JLabel("MOB");
label2.setBounds(20, 100, 100, 20);
c.add(label2);
t2 = new JTextField();
t2.setBounds(130, 100, 100, 20);
c.add(t2);
label3 = new JLabel("Gender");
label3.setBounds(20, 150, 100, 20);
c.add(label3);
male = new JRadioButton("Male");
female = new JRadioButton("Female");
other = new JRadioButton("Other");
male.setBounds(120, 140, 80, 20);
female.setBounds(200, 140, 80, 20);
//other.setBounds(290, 140, 80, 20);
c.add(male);
c.add(female);
//c.add(other);
ButtonGroup gen = new ButtonGroup();
gen.add(male);
gen.add(female);
//gen.add(other);
label4 = new JLabel("DOB");
label4.setBounds(20, 200, 100, 20);
c.add(label4);
String[] days = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
String[] months = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"};
String[] years = {"2018", "2017", "2016"}; // more years can be added
daysComboBox = new JComboBox<>(days);
daysComboBox.setBounds(130, 200, 50, 20);
c.add(daysComboBox);
monthsComboBox = new JComboBox<>(months);
monthsComboBox.setBounds(190, 200, 60, 20);
c.add(monthsComboBox);
yearsComboBox = new JComboBox<>(years);
yearsComboBox.setBounds(260, 200, 60, 20);
c.add(yearsComboBox);
label5 =new JLabel("Address");
label5.setBounds(20,250,100,20);
c.add(label5);
tal=new JTextArea();
tal.setBounds(130,240,200,50);
c.add(tal);
terms=new JCheckBox("Please Accept terms and condations");
terms.setBounds(50,300,250,20);
c.add(terms);
submit=new JButton("Submit");
submit.setBounds(150,350,80,20);
c.add(submit);
screen=new JTextArea();
screen.setBounds(350,50,300,300);
c.add(screen);
msg =new JLabel();
msg.setBounds(200,400,250,20);
c.add(msg);
setVisible(true);
}
}
public class Reg {
public static void main(String[] args) {
MyFrame frame = new MyFrame();
}
}
Comments
Post a Comment