Answer to Question #239595 in HTML/JavaScript Web Application for Precioud

Question #239595

The school of Computing and Mathematical Sciences is open for registration of ICT qualifications. Create a registration form that accepts a prospective student’s name, surname, race, gender, cellphone number, email address, home address and the ICT qualification the student wishes to apply for (Diploma in ICT: Applications Development, Advanced Diploma in ICT: Application Development, Post Graduate Diploma in ICT: Applications Development). Upon completion of the form, the prospective student must agree to the terms and conditions of the university by selecting a checkbox and submit the form. Insert this data into the database. Also include a delete and update button. 


NB: Please align your textboxes and text fields


1
Expert's answer
2021-09-22T07:48:31-0400
import javax.swing.*;
import java.awt.event.*;


import java.awt.*;
public ​class ICTRegistration extends JFrame implements ActionListener{
       private JTextField name, surname, race, gender, cellphone_number, email_addresss, home_address;
    private JLabel label_name, label_surname, label_race, label_gender;
    private JLabel label_cellphone_number, label_email_addresss, label_home_address;
    JButton submit, delete, update;
    ICTRegistration(){  
         // JFrame frame= new JFrame();  
        JFrame f = new JFrame();
         f.setLayout( new FlowLayout());
         JPanel panel = new JPanel(new GridLayout(7,2));
         label_name = new JLabel("Name");    panel.add(label_name);  
         name = new JTextField(20);   panel.add(name);
         label_surname = new JLabel("Surname");  panel.add(label_surname);   
          surname = new JTextField(20);     panel.add(surname);
         label_race = new JLabel("Race");      panel.add(label_race);
         race = new JTextField(20);      panel.add(race);
         label_cellphone_number = new JLabel("CellPhone Number");     panel.add(label_cellphone_number);
          cellphone_number = new JTextField(20);     panel.add(cellphone_number);
         label_gender = new JLabel("Gender");      panel.add(label_gender);
         gender = new JTextField(20);      panel.add(gender);
         label_email_addresss = new JLabel("Email Address");      panel.add(label_email_addresss);
          email_addresss = new JTextField(20);      panel.add(email_addresss);
         label_home_address = new JLabel("Home Address");     panel.add(label_home_address); 
       home_address = new JTextField(20);    panel.add(home_address);
      f.add(panel, BorderLayout.NORTH);
      
      JPanel panel2 = new JPanel(new GridLayout(1,3,3,2));
      
      
      submit  = new JButton("Submit");
      panel2.add(submit);
      submit.addActionListener(this);
       delete  = new JButton("Delete");
      panel2.add(delete);
      delete.addActionListener(this);
      
      update  = new JButton("Update");
      panel2.add(update);
      update.addActionListener(this);
      f.add(panel2, BorderLayout.SOUTH);
     
          
        f.setSize(480,300);  
       
        f.setVisible(true);  
    }         


    public static void main(String[] args) {
     new ICTRegistration();
     
    }


    @Override
    public void actionPerformed(ActionEvent ae) {
        if(ae.getSource()==delete){
            JOptionPane.showMessageDialog(null,"Deleted successfully");
            name.setText(" "); surname.setText(" ");
            race.setText(" ");
            gender.setText(" "); cellphone_number.setText(" ");
            email_addresss.setText(" "); home_address.setText("");
            
        }
        else if(ae.getSource()==submit){
            JOptionPane.showMessageDialog(null,"Submitted successfully");
             name.setText(" "); surname.setText(" ");
            race.setText(" ");
            gender.setText(" "); cellphone_number.setText(" ");
            email_addresss.setText(" "); home_address.setText("");
        }
        
        else if(ae.getSource()==update){
            JOptionPane.showMessageDialog(null,"Updated successfully");
             name.setText(" "); surname.setText(" ");
            race.setText(" ");
            gender.setText(" "); cellphone_number.setText(" ");
            email_addresss.setText(" "); home_address.setText("");
        }
        
      
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS