import java.awt.*;import java.awt.event.*;
import javax.swing.*;import javax.swing.event.*;
class friendste extends JFrame{ JLabel name = new JLabel("Name");
JTextField nametxt= new JTextField(); JLabel spacenim = new JLabel("");
JLabel age = new JLabel("Age"); JTextField agetxt = new JTextField();
JLabel spaceage = new JLabel(""); JLabel religion = new JLabel("Religion");
JTextField religiontxt = new JTextField(); JLabel school = new JLabel("School");
JTextField schooltxt = new JTextField(); JLabel like = new JLabel("Likes");
JTextField liketxt = new JTextField(); JLabel address = new JLabel("Address");
JTextField addtxt = new JTextField(); JLabel status = new JLabel("Status ");
JRadioButton yesstatbtn = new JRadioButton("Single", true);
JRadioButton nostatbtn = new JRadioButton("Married", true); JLabel gender = new JLabel("Gender ");
JRadioButton yesgenbtn = new JRadioButton("Male", true);
JRadioButton nogenbtn = new JRadioButton("Female", true);
JLabel field = new JLabel("FIELDS"); JCheckBox field1 = new JCheckBox("ACOUNTANCY", true);
JLabel space = new JLabel(""); JCheckBox field2 = new JCheckBox("COMPUTER PROGRAMING", true);
JLabel space1 = new JLabel(""); JCheckBox field3 = new JCheckBox("BUSINESS", true);
JLabel space2 = new JLabel(""); JCheckBox field4 = new JCheckBox("BANKING", true);
JLabel space3 = new JLabel(""); JCheckBox field5 = new JCheckBox("FINANCE", true);
JLabel space4 = new JLabel(""); JCheckBox field6 = new JCheckBox("TEACHER", true);
JLabel comment = new JLabel("COMMENTS"); JTextArea commenttxt= new JTextArea();
JLabel me = new JLabel("About Me"); JTextArea metxt= new JTextArea();
JButton btn = new JButton("OK");
public static void main(String[] args) {
JFrame window = new friendste();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(500,250);
window.setVisible(true); window.setResizable(false); window.setForeground(Color.red); }
public friendste() {
Container content = this.getContentPane(); content.setLayout(new GridLayout(10,2));
content.setForeground(Color.red); metxt.setSize(50,50); name.setForeground(Color.RED);
religion.setForeground(Color.RED); age.setForeground(Color.RED); status.setForeground(Color.RED);
gender.setForeground(Color.RED); address.setForeground(Color.RED); like.setForeground(Color.RED);
school.setForeground(Color.RED); field.setForeground(Color.RED); comment.setForeground(Color.RED);
me.setForeground(Color.RED); yesstatbtn.setForeground(Color. red); nostatbtn.setForeground(Color.red);
yesgenbtn.setForeground(Color. red); nogenbtn.setForeground(Color. red);
field1.setForeground(Color. red); field2.setForeground(Color. red); field3.setForeground(Color. red);
field4.setForeground(Color. red); field5.setForeground(Color. red); field6.setForeground(Color. red);
btn.setForeground(Color. red); btn.addActionListener(new action()); content.add(name);
content.add(nametxt); content.add(age); content.add(agetxt); content.add(status);
content.add(spacenim); content.add(gender); content.add(spaceage);
content.add(yesstatbtn); content.add(nostatbtn); content.add(yesgenbtn);
content.add(nogenbtn); content.add(address); content.add(addtxt);
content.add(religion); content.add(religiontxt); content.add(school); content.add(schooltxt);
content.add(like); content.add(liketxt); content.add(field); content.add(field1); content.add(space);
content.add(field2); content.add(space1); content.add(field3); content.add(space2); content.add(field4);
content.add(space3); content.add(field5); content.add(space4); content.add(field6); content.add(me);
content.add(metxt); content.add(comment); content.add(commenttxt); content.add(btn);
ButtonGroup bgroup = new ButtonGroup(); bgroup.add(yesstatbtn); bgroup.add(nostatbtn);
ButtonGroup bgroup1 = new ButtonGroup(); bgroup1.add(yesgenbtn); bgroup1.add(nogenbtn);
ButtonGroup bgroup2 = new ButtonGroup(); bgroup2.add(field1); bgroup2.add(field2);
bgroup2.add(field3); bgroup2.add(field4); bgroup2.add(field5); bgroup2.add(field6);
this.setTitle("FRIENDSTER");
this.pack(); }
class action implements ActionListener {
public void actionPerformed(ActionEvent e) {
String nim=nametxt.getText(); String asa =nim.toUpperCase();
String agez=agetxt.getText(); int nam=Integer.parseInt(agez);
String add="Address: "+addtxt.getText(); String rel="Religion: "+religiontxt.getText();
String skul="School: "+schooltxt.getText(); String lyk="Likes: "+liketxt.getText();
String ab="About Me: "+ metxt.getText(); String com="Comments: "+commenttxt.getText(); String gen;
if(yesgenbtn.isSelected()) gen=new String ("male"); else gen=new String("female"); String stat;
if(yesstatbtn.isSelected()) stat=new String ("Single"); else stat=new String ("Married"); String fildz;
if (field1.isSelected()) fildz=new String ("Acountancy"); else fildz=new String ("Computer Programing");
if (field3.isSelected()) fildz=new String ("Business"); if(field4.isSelected()) fildz=new String ("Banking");
if (field5.isSelected()) fildz=new String ("Finance"); if(field6.isSelected())
fildz=new String ("Teacher");
JOptionPane.showMessageDialog(null,
"Name: "+asa+"\n "+"\n "+ "Age: "+ nam+"\n "+"\n "+
"Status: "+stat+"\n"+"\n "+
"Gender: "+gen+"\n"+"\n "+
add+"\n"+"\n "+
rel+"\n"+"\n "+
skul+"\n"+"\n "+
lyk+"\n"+"\n "+
"Fields: "+fildz+"\n"+"\n "+ ab+"\n"+"\n "+ com); } } }
