0% found this document useful (0 votes)
26 views6 pages

Subject: Advanced Java Technology (170703) : Piet (Cse)

This document describes a Java application that performs a login operation using core Java concepts. The application contains labels, text fields, buttons, checkboxes, dropdown menus, and lists to collect user information like enrollment number, name, hostel, transport, club, college, branch, and subject. When the submit button is clicked, the selected values are stored in a string and displayed in a text area.

Uploaded by

Neeti Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views6 pages

Subject: Advanced Java Technology (170703) : Piet (Cse)

This document describes a Java application that performs a login operation using core Java concepts. The application contains labels, text fields, buttons, checkboxes, dropdown menus, and lists to collect user information like enrollment number, name, hostel, transport, club, college, branch, and subject. When the submit button is clicked, the selected values are stored in a string and displayed in a text area.

Uploaded by

Neeti Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

PIET(CSE) Subject: Advanced Java Technology(170703)

Enrollment No:110370131042 Page No:1


PRACTICAL NO:1
AIM: Create a standalone application for performing login operation using core java
concepts.
Code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code="Student.java" width=500 height=500>
</applet>
*/
public class Student extends Applet implements ActionListener
{
Label l1,l2,l3,l4,l5,l6,l7,l8;
TextField t1,t2,t3;
Button b;
Checkbox c1,c2,c3,c4,c5,c6;
CheckboxGroup cb1,cb2;
Choice ch1,ch2;
List lt;
TextArea ta;
String msg;

public void init()
{

l1=new Label("Enter Enrollment No: :");
l2=new Label("Name :");
l3=new Label("Hostel :");
l4=new Label("Transport :");
PIET(CSE) Subject: Advanced Java Technology(170703)
Enrollment No:110370131042 Page No:2
l5=new Label("Club :");
l6=new Label("College :");
l7=new Label("Branch :");
l8=new Label("Subject :");

t1=new TextField(10);
t2=new TextField(10);

cb1=new CheckboxGroup();
cb2=new CheckboxGroup();

c1=new Checkbox("Yes",cb1,true);
c2=new Checkbox("No",cb1,false);
c3=new Checkbox("Yes",cb2,true);
c4=new Checkbox("No",cb2,false);

c5=new Checkbox("Health");
c6=new Checkbox("Library");

ch1=new Choice();
ch1.add("PIET");
ch1.add("PIT");
ch1.add("VIT");
ch1.add("M.S.");

ch2=new Choice();
ch2.add("CSE");
ch2.add("IT");
ch2.add("EC");
ch2.add("CIVIL");
PIET(CSE) Subject: Advanced Java Technology(170703)
Enrollment No:110370131042 Page No:3

lt=new List();
lt.add("C++");
lt.add("JAVA");
lt.add("WAD");
lt.add("AJT");

b=new Button("Submit");
ta=new TextArea(10,50);

add(l1);
add(t1);
add(l2);
add(t2);
add(l3);
add(c1);
add(c2);
add(l4);
add(c3);
add(c4);
add(l5);
add(c5);
add(c6);
add(l6);
add(ch1);
add(l7);
add(ch2);
add(l8);
add(lt);
add(b);
PIET(CSE) Subject: Advanced Java Technology(170703)
Enrollment No:110370131042 Page No:4

msg="\n";
add(ta);

b.addActionListener(this);
}

public void actionPerformed(ActionEvent e)
{
String s1,s2,s3,s4,s5,s6,s7,s8,s9;

s1=t1.getText();
s2=t2.getText();

if(c1.getState())
{
s3=c1.getLabel();
}
else
{
s3=c2.getLabel();
}

msg="No:"+s1+"\nName:"+s2+"\nHostel:"+s3+"\n";

if(c3.getState())
{
s4=c3.getLabel();
}

PIET(CSE) Subject: Advanced Java Technology(170703)
Enrollment No:110370131042 Page No:5
else
{
s4=c4.getLabel();
}
msg+="Transport:"+s4+"\n";
if(c5.getState())
{
s5=c5.getLabel();
}
else
{
s5=c6.getLabel();
}
msg+="Club:"+s5+"\n";
s7=ch1.getSelectedItem();
s8=ch2.getSelectedItem();
s9=lt.getSelectedItem();
msg+="College"+s7+"\nBranch:"+s8+"\nSubject:"+s9;
ta.setText(msg);
}
}









PIET(CSE) Subject: Advanced Java Technology(170703)
Enrollment No:110370131042 Page No:6
Output:

You might also like