0
/**
 * Help me to solve this one
 * 
 * The input for input dialog should appear at right textfield 
 *
 * ex. your firstname? >>> john
 * john should appear at the textfield label firstname
 */



import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;



public class Info extends Applet {



    Label fn,ln,age,gender,course;
    TextField txt1,txt2,txt3,txt4,txt5;
    CheckboxGroup cbg1,cbg2;
    Checkbox male,female,bsit,bsn,bshrm,bsce;


    public void init()
    {
        String fname;
        String lname;
        String age1;



        lname = JOptionPane.showInputDialog("Your LastName ?");
        fname = JOptionPane.showInputDialog("Your FirstName ?");
        age1 = JOptionPane.showInputDialog("Your Age ?");




        setLayout(null);
        cbg1 = new CheckboxGroup();
        cbg2 = new CheckboxGroup();
        ln = new Label("LastName :");
        fn = new Label("FirstName :");
        age = new Label("Age :");
        gender = new Label("Gender :");
        course = new Label("Course :");
        txt1 = new TextField(20);
        txt2 = new TextField(20);
        txt3 = new TextField(20);
        txt4 = new TextField(20);
        txt5 = new TextField(20);
        male = new Checkbox("Male",cbg1,false);
        female = new Checkbox("Female",cbg1,false);
        bsit = new Checkbox("BSIT",cbg2,false);
        bsn = new Checkbox("BSN",cbg2,false);
        bshrm = new Checkbox("BSHRM",cbg2,false);
        bsce = new Checkbox("BSCE",cbg2,false);

        add(fn);
        add(ln);
        add(age);
        add(gender);
        add(course);
        add(txt1);
        add(txt2);
        add(txt3);
        add(txt4);
        add(txt5);
        add(male);
        add(female);
        add(bsit);
        add(bsn);
        add(bshrm);
        add(bsce);



        ln.setBounds(30,40,80,20);
        txt1.setBounds(110,40,100,18);
        fn.setBounds(30,60,80,20);
        txt2.setBounds(110,60,100,18);
        age.setBounds(30,80,80,20);
        txt3.setBounds(110,80,50,18);
        gender.setBounds(30,100,80,20);
        male.setBounds(110,100,50,18);
        female.setBounds(180,100,150,18);
        course.setBounds(30,120,80,20);
        bsit.setBounds(110,120,50,18);
        bsn.setBounds(110,140,50,18);
        bshrm.setBounds(110,160,65,18);
        bsce.setBounds(110,180,50,18);

    }
}

Edited by mike_2000_17: Fixed formatting

4
Contributors
3
Replies
10
Views
6 Years
Discussion Span
Last Post by JamesCherrill
1

Hi Darren

Please start your own new thread for your question - do not hijack other people's old threads. Don't forget to ask clearly what help you need, and show what you have done so far. Someone will help you.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.