BCA

AJAVA LAB

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6

PART B

PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10 PROGRAM 11 PROGRAM 12 PROGRAM 13 PROGRAM 14 PROGRAM 15 . . .

8.Write a java program to ` a. Design a job application/student admission form using swings b. Create the JAR file(when you double click the jar file, application form opens)
Command to create jar:

 
 

8.Write a java program to
`   a. Design a job application/student admission form using swings
    b. Create the JAR file(when you double click the jar file, application form opens)
    
    
    

import javax.swing.*;
import java.awt.*;
import java.awt.Image;
import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; 
 
import java.io.*;
import java.io.IOException;

 import javax.swing.*;
public class Program8 extends JFrame  {
        JLabel l1, l2, l3, l4,		l5, l6, l7, l8	,label	 ;
        JTextField t1, t2,t3, t4,t5, t6, t7,t8;
        JTextArea   t5area;
JComboBox   c1;
        JButton clear, submit;
        Program8()
         {
 
        l1 = new JLabel("Student Application");
		l1.setBounds(100, 100, 250, 30);

		l2 = new JLabel("Name of the Student:");
		l2.setBounds(50, 150, 250, 30);

		t2 = new JTextField();
		t2.setBounds(250, 150, 250, 30);

		 

		l3 = new JLabel("Roll Number:");
		l3.setBounds(50, 200, 250, 30);

		t3 = new JTextField();
		t3.setBounds(250, 200, 250, 30);

	 

		l4 = new JLabel("Contact Number:");
		l4.setBounds(50, 250, 250, 30);

		t4 = new JTextField();
		t4.setBounds(250, 250, 250, 30);


		l5 = new JLabel("Address:");
		l5.setBounds(50, 300, 250, 30);

		t5area = new JTextArea();
		t5area.setBounds(250, 300, 250, 90);

		l6 = new JLabel("Gender:");
		l6.setBounds(50, 400, 250, 20);
                JRadioButton r5     = new JRadioButton(" Male");
		                JRadioButton r6  = new JRadioButton(" Female");

		                r5.setBounds(250, 400, 100, 30);
		                r6.setBounds(350, 400, 100, 30);

		ButtonGroup bg = new ButtonGroup();
		bg.add(r5);
		bg.add(r6);

       l7= new JLabel("SELECT COURSE:");
       l7.setBounds(50, 450, 250, 30);


        String s1[] = { "BCA", "BSC", "BCOM", "BA" };
 
        // create checkbox
         c1 = new JComboBox(s1);
 
		c1.setBounds(250, 450, 250, 30);

        clear = new JButton("clear");
		clear.setBounds(50, 500, 150, 50);


        submit = new JButton("SUBMIT");
		submit.setBounds(250, 500, 150, 50);

	    add(l1);
		add(l2);
		add(l3);
		add(l4);
		add(l5);
		add(l6);
		 add(l7);
	  
		add(t2);
		add(t3);
		add(t4);

		  add(c1); 
	    add(r5); add(r6);
		add(t5area);

        add(clear);
    add(submit);

        clear.addActionListener( new ActionListener() {
				        public void actionPerformed(ActionEvent e)
				        {
					         
					        t5area.setText(" ");
					        t2.setText("");
					        t3.setText("");
					        t4.setText("");
					      
					       
				        }
			        });



 submit.addActionListener( new ActionListener() {
				        public void actionPerformed(ActionEvent e)
				        {
                        String Gender="";
					             if (r5.isSelected()) {	
                                Gender ="Male";
				                    }
				                    if (r6.isSelected()) { 
                                Gender ="Female";
				                    }
					      String applicaiton="Student Name: " + t2.getText() + "\n"+
                                             "RollNumber  : " + t3.getText() + "\n"+
                                             "Contact Number: " + t4.getText() + "\n"+
                                             "Gender : " +  Gender+ "\n"+
                                             "Address: " + t5area.getText() + "\n"+
                                             "course: " + c1.getSelectedItem() + "\n";

					    //   JOptionPane.showMessageDialog(null, "Application Submite \n"+applicaiton);
                    JOptionPane optionPane = new JOptionPane("Application Submite \n"+applicaiton,JOptionPane.WARNING_MESSAGE);
                    JDialog dialog = optionPane.createDialog("Info!");
                    dialog.setAlwaysOnTop(true); // to show top of all other application
                    dialog.setVisible(true); 
					                           
				        }
			        });




         setLayout(null);
         setSize(600, 600);
         setVisible(true);
         setTitle("Program7 is Running");
         
              }    //construtor
             public static void main(String[] args)
	            {
		            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            new Program8();
                        }
                    });
                
	            }
 }//class