JAVA Program using Swing to Design Registration Form

JAVA Program using Swing to Design Registration Form:

import javax.swing.*;
import java.awt.*;

public class swingForm extends JApplet
{

    swingForm()
    {
      String lang[] = {"C","C++","Java","Pascal","PHP",".Net"};

      JFrame jf= new JFrame("Swing Component");
      JButton bok= new JButton("Ok");
      JButton bclear = new JButton("Clear");
      JRadioButton rm = new JRadioButton("Male",true);
      JRadioButton rf = new JRadioButton("Female");
      ButtonGroup bg = new ButtonGroup();

      JLabel lgender = new JLabel(" Gender");
      JLabel los = new JLabel(" Operating System");
      JLabel lblank = new JLabel();

      JCheckBox cb1 = new  JCheckBox("Dos");
      JCheckBox cb2 = new  JCheckBox("Windows");
      JCheckBox cb3 = new  JCheckBox("Linux");
      JCheckBox cb4 = new  JCheckBox("Mac");

      JLabel llang = new JLabel("    Lanuages Know");
      JList list = new JList(lang);

      JScrollPane sb1 = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

      JLabel lna = new JLabel("  Name");
      JLabel ladd = new JLabel("     Address");

      JTextField tname = new JTextField(20);
      JTextArea tadd = new JTextArea(2,20);

      JPanel jp1 = new JPanel();
      JPanel jp2 = new JPanel(new GridLayout(1,3));
      JPanel jp3 = new JPanel();
      JPanel jp4 = new JPanel(new GridLayout(1,2));

      JPanel jp5 = new JPanel();
      JPanel jp6 = new JPanel(new GridLayout(5,1));

      // Adding radio Button  to group
      bg.add(rm);
      bg.add(rf);


      jp1.add(lna);
      jp1.add(tname);
      jp1.add(ladd);
      jp1.add(tadd);

      jp2.add(lgender);
      jp2.add(rm);
      jp2.add(rf);

      jp3.setLayout(new GridLayout(2,3));
      jp3.add(los);
      jp3.add(cb1);
      jp3.add(cb2);
      jp3.add(cb3);
      jp3.add(cb4);

      jp4.add(llang);
      jp4.add(sb1,BorderLayout.NORTH);
      jp5.add(bok);
      jp5.add(bclear);

      jp6.add(jp1);
      jp6.add(jp2);
      jp6.add(jp3);
      jp6.add(jp4);
      jp6.add(jp5);

      jf.add(jp6);

      jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
      jf.setSize(350,400);
      jf.setVisible(true);
  }


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

OUTPUT:

JAVA Program using Swing to Design Registration Form

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.