Registration Form
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Toolkit;
public class Registration extends JFrame {
// member variables (of global level)
private JPanel contentPane;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_3;
private JTextField textField_4;
private JTextField textFieldName;
private JTextField txtRollNo;
private JTextField txtMarks;
private JTextField txtBoard;
private JTextField txtYear;
private JTextField textField_2;
private JTextField textField_6;
private JTextField textField_7;
private JTextField textField_8;
private JTextField textField_9;
private JTextField textField_10;
private JTextField textField_11;
private JTextField textField_12;
public Registration() {
setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\Ali\\Desktop\\pic for project\\HU_logo_jpeg_400x400.png"));
setResizable(false);
setTitle("Registration");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 568, 709);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("Registration");
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setBounds(194, 111, 186, 36);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("");
lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\Ali\\Desktop\\pic for project\\small.png"));
lblNewLabel_1.setBounds(10, 11, 103, 100);
contentPane.add(lblNewLabel_1);
JLabel lblNewLabel_2 = new JLabel("Name");
lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblNewLabel_2.setBounds(42, 184, 55, 23);
contentPane.add(lblNewLabel_2);
JLabel lblFathersName = new JLabel("Father's Name");
lblFathersName.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblFathersName.setBounds(42, 218, 103, 23);
contentPane.add(lblFathersName);
JLabel lblCnicNo = new JLabel("ID Card/Bay foam");
lblCnicNo.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblCnicNo.setBounds(42, 252, 103, 23);
contentPane.add(lblCnicNo);
JLabel lblTelephoneNo = new JLabel("Telephone No.");
lblTelephoneNo.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblTelephoneNo.setBounds(42, 320, 103, 23);
contentPane.add(lblTelephoneNo);
JLabel lblEmail = new JLabel("E-mail");
lblEmail.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblEmail.setBounds(42, 354, 103, 23);
contentPane.add(lblEmail);
JLabel lblGender = new JLabel("Gender");
lblGender.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblGender.setBounds(42, 286, 103, 23);
contentPane.add(lblGender);
JLabel lblDiscipline = new JLabel("Discipline");
lblDiscipline.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblDiscipline.setBounds(42, 388, 103, 23);
contentPane.add(lblDiscipline);
JComboBox comboBox = new JComboBox();
comboBox.setBackground(Color.WHITE);
// list given for selection in comoBox
comboBox.setModel(new DefaultComboBoxModel(new String[] {"Computer Studies", "Business Studies", "Media Studies", "Pharma Studies", "Fashion Studies", "Management Studies"}));
comboBox.setBounds(206, 390, 248, 20);
contentPane.add(comboBox);
textField = new JTextField();
textField.setBounds(206, 356, 248, 20);
contentPane.add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(206, 322, 248, 20);
contentPane.add(textField_1);
textField_3 = new JTextField();
textField_3.setColumns(10);
textField_3.setBounds(206, 254, 248, 20);
contentPane.add(textField_3);
textField_4 = new JTextField();
textField_4.setColumns(10);
textField_4.setBounds(206, 220, 248, 20);
contentPane.add(textField_4);
textFieldName = new JTextField();
textFieldName.setColumns(10);
textFieldName.setBounds(206, 186, 248, 20);
contentPane.add(textFieldName);
JRadioButton rdbtnTypeD =new JRadioButton("Male");
rdbtnTypeD.setBackground(Color.WHITE);
rdbtnTypeD.setBounds(206, 286, 86, 23);
JRadioButton rdbtnTypeC = new JRadioButton("Female");
rdbtnTypeC.setBackground(Color.WHITE);
rdbtnTypeC.setBounds(303, 286, 105, 23);
// for group the radio button
ButtonGroup group = new ButtonGroup();
group.add(rdbtnTypeD);
group.add(rdbtnTypeC);
// to add the radio button in pane
getContentPane().add(rdbtnTypeD);
getContentPane().add(rdbtnTypeC);
JLabel lblMatriculation = new JLabel("Academic Record");
lblMatriculation.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblMatriculation.setBounds(42, 422, 114, 23);
contentPane.add(lblMatriculation);
JLabel lblMatriculation_1 = new JLabel("Matriculation");
lblMatriculation_1.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblMatriculation_1.setBounds(93, 471, 114, 23);
contentPane.add(lblMatriculation_1);
JLabel lblIntermediate = new JLabel("Intermediate");
lblIntermediate.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblIntermediate.setBounds(93, 505, 114, 23);
contentPane.add(lblIntermediate);
JLabel lblGraduation = new JLabel("Graduation");
lblGraduation.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblGraduation.setBounds(93, 539, 114, 23);
contentPane.add(lblGraduation);
txtRollNo = new JTextField();
txtRollNo.setForeground(Color.LIGHT_GRAY);
txtRollNo.setText("Roll No");
txtRollNo.setColumns(10);
txtRollNo.setBounds(194, 473, 73, 20);
contentPane.add(txtRollNo);
txtMarks = new JTextField();
txtMarks.setForeground(Color.LIGHT_GRAY);
txtMarks.setText("Marks");
txtMarks.setColumns(10);
txtMarks.setBounds(283, 473, 73, 20);
contentPane.add(txtMarks);
txtBoard = new JTextField();
txtBoard.setForeground(Color.LIGHT_GRAY);
txtBoard.setText("Board");
txtBoard.setColumns(10);
txtBoard.setBounds(366, 473, 73, 20);
contentPane.add(txtBoard);
txtYear = new JTextField();
txtYear.setForeground(Color.LIGHT_GRAY);
txtYear.setText("Year");
txtYear.setColumns(10);
txtYear.setBounds(449, 473, 73, 20);
contentPane.add(txtYear);
textField_2 = new JTextField();
textField_2.setText("Roll No");
textField_2.setForeground(Color.LIGHT_GRAY);
textField_2.setColumns(10);
textField_2.setBounds(194, 505, 73, 20);
contentPane.add(textField_2);
textField_6 = new JTextField();
textField_6.setText("Marks");
textField_6.setForeground(Color.LIGHT_GRAY);
textField_6.setColumns(10);
textField_6.setBounds(283, 505, 73, 20);
contentPane.add(textField_6);
textField_7 = new JTextField();
textField_7.setText("Board");
textField_7.setForeground(Color.LIGHT_GRAY);
textField_7.setColumns(10);
textField_7.setBounds(366, 505, 73, 20);
contentPane.add(textField_7);
textField_8 = new JTextField();
textField_8.setText("Year");
textField_8.setForeground(Color.LIGHT_GRAY);
textField_8.setColumns(10);
textField_8.setBounds(449, 505, 73, 20);
contentPane.add(textField_8);
textField_9 = new JTextField();
textField_9.setText("Roll No");
textField_9.setForeground(Color.LIGHT_GRAY);
textField_9.setColumns(10);
textField_9.setBounds(194, 539, 73, 20);
contentPane.add(textField_9);
textField_10 = new JTextField();
textField_10.setText("Marks");
textField_10.setForeground(Color.LIGHT_GRAY);
textField_10.setColumns(10);
textField_10.setBounds(283, 539, 73, 20);
contentPane.add(textField_10);
textField_11 = new JTextField();
textField_11.setText("Board");
textField_11.setForeground(Color.LIGHT_GRAY);
textField_11.setColumns(10);
textField_11.setBounds(366, 539, 73, 20);
contentPane.add(textField_11);
textField_12 = new JTextField();
textField_12.setText("Year");
textField_12.setForeground(Color.LIGHT_GRAY);
textField_12.setColumns(10);
textField_12.setBounds(449, 539, 73, 20);
contentPane.add(textField_12);
JButton btnNewButton = new JButton("Submit Me");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null,textFieldName.getText()+" your registration is submitted in "+comboBox.getSelectedItem());
}
});
btnNewButton.setBounds(223, 602, 133, 30);
contentPane.add(btnNewButton);
JPanel panel = new JPanel();
panel.setBackground(Color.WHITE);
panel.setBounds(0, 167, 562, 410);
contentPane.add(panel);
JButton btnNewButton_1 = new JButton("Back");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MainInter m = new MainInter();
m.setVisible(true);
dispose();
}
});
btnNewButton_1.setBounds(0, 657, 63, 23);
contentPane.add(btnNewButton_1);
}
}
Comments
Post a Comment