In this example , I have taken Java swings components like Jpanel, JFrame, JButton, JRadioButton , JCheckBox, JCombobox and Jlabel.This is an simple registration form.
import javax.swing.*; import java.awt.FlowLayout; import java.awt.event.*; public class MainClass extends JFrame { MainClass() { JPanel jp=new JPanel(); addcomponent(jp); this.add(jp); setSize(850,850); setVisible(true); } private static void addcomponent(JPanel jpn) { jpn.setLayout(null); JLabel jl1=new JLabel("User Name"); jl1.setBounds(20,30,100,20); jpn.add(jl1); JTextField jt1=new JTextField(); jt1.setBounds(120,30,80,20); jpn.add(jt1); JLabel jl2=new JLabel("Password"); jl2.setBounds(20,70,100,20); jpn.add(jl2); JPasswordField jt2=new JPasswordField(); jt2.setBounds(120,70,80,20); jpn.add(jt2); JLabel jlh1=new JLabel("Hobbies"); jlh1.setBounds(20,160,100,20); jpn.add(jlh1); JCheckBox jcb=new JCheckBox("Reading", true); jcb.setBounds(130,160,200,20); JCheckBox jcb1=new JCheckBox("Writing"); jcb1.setBounds(240,160,200,20); jpn.add(jcb1); jpn.add(jcb); //RadioButtons JLabel jlg1=new JLabel("Gender"); jlg1.setBounds(20,190,100,20); jpn.add(jlg1); JRadioButton jrb1=new JRadioButton("Male"); jrb1.setBounds(130,190,100,20); jpn.add(jrb1); JRadioButton jrb2=new JRadioButton("Female"); jrb2.setBounds(240,190,100,20); jpn.add(jrb2); ButtonGroup bg=new ButtonGroup(); bg.add(jrb1); bg.add(jrb2); //Combo Box JLabel jlstate=new JLabel("State"); jlstate.setBounds(20,210,100,20); jpn.add(jlstate); String[] state={"Rajasthan","UP","MP"}; JComboBox jcombo=new JComboBox(state); jcombo.setBounds(130,210,100,20); jpn.add(jcombo); JButton jb=new JButton("Register Me"); jb.setBounds(130,240,130,30); jpn.add(jb); } public static void main(String[] args) { // TODO Auto-generated method stub MainClass obj=new MainClass(); } }