-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram5.java
More file actions
241 lines (200 loc) · 5.81 KB
/
Program5.java
File metadata and controls
241 lines (200 loc) · 5.81 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import com.toedter.calendar.*;
public class Program5 implements ActionListener {
JFrame f;
JPanel p1,p2;
JLabel title,title1,un, fn, mn ,gen , Dob, Mb , Em ,Add, Cou, B,DoA;
JButton Submit, Reset,Exit;
JTextField user ,fou,mou,mb,em;
JTextArea add,database;
JCheckBox cb;
JRadioButton male , female;
JComboBox box4,box5;
JDateChooser indob,indoa;
Program5(){
f = new JFrame("Student registration form by Niraj Ramnani 22EARCS114");
p1 = new JPanel();
p2 = new JPanel();
p1.setBounds(30,20,450,720);
p1.setBackground(Color.white);
Border line=BorderFactory.createTitledBorder("Fill Registration form");
p1.setBorder(line);
p1.setLayout(null);
p1.setVisible(true);
p2.setBounds(500,20,500,500);
p2.setBackground(Color.white);
Border line1=BorderFactory.createTitledBorder("Student Database");
p2.setBorder(line1);
p2.setLayout(null);
p2.setVisible(true);
title1 = new JLabel("Student information");
title1.setBounds(50,20,300,50);
title1.setFont(new Font("Times New Roman",Font.BOLD,20));
database = new JTextArea();
database.setBounds(50,80,400,400);
Border b = BorderFactory.createLineBorder(Color.black);
database.setBorder(b);
title = new JLabel("Student Registration Form by Niraj");
un = new JLabel("Student's name");
fn = new JLabel("Father name");
mn = new JLabel("Mother name");
gen = new JLabel("Gender");
Dob = new JLabel("Date of Birth");
Mb = new JLabel("Mobile Number");
Em = new JLabel("E-Mail ID");
Add = new JLabel("Address");
Cou = new JLabel("Course");
B = new JLabel("Branch");
DoA = new JLabel("Date of Admission");
user = new JTextField();
fou = new JTextField();
mou = new JTextField();
mb = new JTextField();
em = new JTextField();
add = new JTextArea();
add.setBorder(b);
male = new JRadioButton("Male");
female = new JRadioButton("Female");
ButtonGroup bg=new ButtonGroup();
bg.add(male);
bg.add(female);
String course[]= {"Select your Course","B.Tech","M.Tech","MBA","B.Sc"};
box4=new JComboBox<>(course);
String branch[]= {"Select your Branch","Computer Science","Artificial Intelligence And Data Science","Information Technology","Electronics and Communication Engineering","Mechanical Engineering"};
box5=new JComboBox<>(branch);
cb = new JCheckBox("Please accept the terms and condition");
Submit = new JButton("Submit");
Reset = new JButton("Reset");
Exit= new JButton("Exit");
indob = new JDateChooser();
indoa = new JDateChooser();
title.setBounds(35,20,500,50);
title.setFont(new Font("Times New Roman",Font.BOLD,25));
title.setForeground(Color.red);
un.setBounds(20,70,100,30);
fn.setBounds(20,110,100,30);
mn.setBounds(20,150,100,30);
gen.setBounds(20,190,100,30);
Dob.setBounds(20,230,100,30);
Mb.setBounds(20,270,100,30);
Em.setBounds(20,310,100,30);
Add.setBounds(20,380,100,30);
Cou.setBounds(20,470,100,30);
B.setBounds(20,510,100,30);
DoA.setBounds(20,550,120,30);
user.setBounds(140,70,260,25);
fou.setBounds(140,110,260,25);
mou.setBounds(140,150,260,25);
mb.setBounds(140,270,260,25);
em.setBounds(140,310,260,25);
add.setBounds(140,350,260,100);
cb.setBounds(120,600,260,25);
cb.setBackground(Color.white);
p1.add(cb);
male.setBounds(140,200,110,25);
male.setBackground(Color.white);
female.setBounds(250,200,110,25);
female.setBackground(Color.white);
Submit.setBounds(50,660,90,25);
Reset.setBounds(190,660,90,25);
Exit.setBounds(330,660,90,25);
indob.setBounds(140,230,260,25);
indoa.setBounds(140,550,260,25);
box4.setBounds(140,470,260,25);
box4.setBackground(Color.white);
box5.setBounds(140,510,260,25);
box5.setBackground(Color.white);
p1.add(Submit);
p1.add(Reset);
p1.add(Exit);
p1.add(title);
p1.add(un);
p1.add(fn);
p1.add(mn);
p1.add(gen);
p1.add(Dob);
p1.add(Mb);
p1.add(Em);
p1.add(Add);
p1.add(Cou);
p1.add(B);
p1.add(DoA);
p1.add(user);
p1.add(fou);
p1.add(mou);
p1.add(add);
p1.add(mb);
p1.add(em);
p1.add(male);
p1.add(female);
p1.add(indob);
p1.add(indoa);
p1.add(box4);
p1.add(box5);
p2.add(database);
p2.add(title1);
f.add(p1);
f.add(p2);
f.setSize(1050,800);
f.setResizable(false);
f.setLayout(null);
f.setVisible(true);
Submit.addActionListener(this);
Reset.addActionListener(this);
Exit.addActionListener(this);
cb.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()== Submit)
{
if(cb.isSelected())
{
DateFormat df = new SimpleDateFormat("dd-MM-YYYY");
database.setText("Name :" + user.getText()+"\nfather Name :" + fou.getText()+"\nMother Name :"+mou.getText()+
"\nGender :"+(male.isSelected()?"Male":"Female")+"\nDate of Birth :"+df.format(indob.getDate())+"\nAddress :"
+ ""+add.getText()+"\nMobile No. :"+mb.getText()+"\nEmail id :"+em.getText()+"\ncourse :"+box4.getSelectedItem()
+"\nBranch :"+box5.getSelectedItem()+"\nDate of Addmission"+df.format(indoa.getDate()) );
}
else
{
JOptionPane.showMessageDialog(f, "click on check Box");
}
}
if(e.getSource()==Reset)
{
fou.setText("");
user.setText("");
mou.setText("");
add.setText("");
mb.setText("");
em.setText("");
male.setSelected(true);
cb.setSelected(false);
box4.setSelectedIndex(0);
box5.setSelectedIndex(0);
indob.setDate(null);
indoa.setDate(null);
}
if(e.getSource()==Exit)
{
System.exit(0);
}
}
public static void main(String[] args)
{
// TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
new Program5();
}
});
}
}