33 */
44package Day11_Swing ;
55import java .util .*;
6- import java .awt .EventQueue ;
76
8- import javax .swing .ButtonGroup ;
9- import javax .swing .JFrame ;
10- import javax .swing .JLabel ;
11- import javax .swing .JOptionPane ;
127
13- import java .awt .Font ;
14- import javax .swing .JTextField ;
158
16- import org .jdatepicker .impl .JDatePanelImpl ;
17- import org . jdatepicker . impl . JDatePickerImpl ;
18- import org . jdatepicker . impl . UtilDateModel ;
9+ import org .jdatepicker .impl .* ;
10+ import java . text .* ;
11+ import java . time . format .* ;
1912
20- import javax .swing .JTextArea ;
21- import javax .swing .JRadioButton ;
22- import javax .swing .JButton ;
23- import javax .swing .JFormattedTextField .AbstractFormatter ;
24-
25- import java .awt .event .ActionListener ;
26- import java .text .ParseException ;
27- import java .text .SimpleDateFormat ;
28- import java .time .format .DateTimeFormatter ;
29- import java .awt .event .ActionEvent ;
3013import javax .swing .JPanel ;
14+ import java .awt .*;
15+ import java .awt .event .ActionEvent ;
16+ import java .awt .event .ActionListener ;
17+
18+ import javax .swing .*;
19+ import javax .swing .JFormattedTextField .AbstractFormatter ;
3120
32- /**
33- * @author M.NAVEEN
34- * RANDOM CODER'S
35- * Tech/Project Lead Android Club
36- */
3721public class Gui {
3822
3923 private JFrame frame ;
4024 private JTextField textField ;
4125 private JTextField textField_1 ;
4226 private JTextField textField_2 ;
27+
4328 private JTextField textField_3 ;
4429 private JTextField textField_4 ;
4530 String Name ,mName ,LName ,Number ,Adrress ,profession ;
@@ -123,6 +108,7 @@ private void initialize() {
123108
124109 textField_3 = new JTextField ();
125110 textField_3 .setBounds (230 , 305 , 161 , 29 );
111+
126112 frame .getContentPane ().add (textField_3 );
127113 textField_3 .setColumns (10 );
128114
@@ -209,7 +195,11 @@ public void actionPerformed(ActionEvent arg0)
209195 JButton btnPrint = new JButton ("Print" );
210196 btnPrint .addActionListener (new ActionListener () {
211197 public void actionPerformed (ActionEvent arg0 )
212- {
198+ {
199+ String textString =textField_3 .getText ();
200+ if (textString .length ()>10 )
201+ {JOptionPane .showMessageDialog (textField_3 ,"Error Number must be Less 11" );return ;}
202+
213203 Name =textField .getText ();
214204 // System.out.println("Nmae :"+Name);
215205 mName =textField_1 .getText ();
@@ -218,7 +208,7 @@ public void actionPerformed(ActionEvent arg0)
218208 //System.out.println(Adrress);
219209 String Number =textField_3 .getText ();
220210 String profession =textField_4 .getText ();
221- JOptionPane .showMessageDialog (textField ,"NAME :" +Name +" " +mName +" " +LName +"\n " +"Adress :" +Adrress +"\n " +"Number :" +Number +"\n Profession :" +profession );
211+ JOptionPane .showMessageDialog (textField ,"NAME :" +Name +" " +mName +" " +LName +"\n " +"Adress :" +Adrress +"\n " +"Number :" +Number +"\n Profession :" +profession + "DOB :" + datee );
222212
223213 }
224214 });
0 commit comments