0% found this document useful (0 votes)
53 views5 pages

Java GUI Application Example

The document describes a Java GUI application that implements a registration form with fields for class, shift, city and a registration button. It displays the form, handles button clicks and displays output in a text area.

Uploaded by

Should Should
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)
53 views5 pages

Java GUI Application Example

The document describes a Java GUI application that implements a registration form with fields for class, shift, city and a registration button. It displays the form, handles button clicks and displays output in a text area.

Uploaded by

Should Should
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

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package guiapplication;

import [Link].*;

import [Link].*;

/**

* @author adminuser

*/

public class GUIApplication implements ActionListener{

/**

* @param args the command line arguments

*/

Frame f;

Label lblClass;

TextField txtInput;

CheckboxGroup chkShift;

Checkbox chkMor;

Checkbox chkAft;

Choice chCities;

Button btnRegister;

Label lblMsg;

TextArea txtArea;
Button btnClose;

GUIApplication(){

f = new Frame("First Screen");

lblClass = new Label("Class");

txtInput = new TextField();

txtArea = new TextArea();

lblMsg = new Label("Message will appear here");

Checkbox chkSE = new Checkbox("Software Engineering");

Checkbox chkCS = new Checkbox("Computer Science");

Checkbox chkEE = new Checkbox("Electrical Engineering");

chkShift = new CheckboxGroup();

chkMor = new Checkbox("Morning", chkShift, true);

chkAft = new Checkbox("Afternoon", chkShift, false);

chCities = new Choice();

[Link]("Islamabad");

[Link]("Peshawar");

[Link]("Multan");

[Link]("Quetta");

[Link]("Rawalpindi");

btnRegister = new Button("Register");

[Link]([Link]);

[Link](this);

btnClose = new Button("Close");


[Link]([Link]);

[Link](this);

[Link](20, 40, 40, 25);

[Link](60, 40, 150, 25);

[Link](20, 80, 200, 150);

[Link](20, 280, 150, 25);

[Link](20, 310, 150, 25);

[Link](20, 340, 150, 25);

[Link](20, 370, 150, 25);

[Link](20, 400, 150, 25);

[Link](20, 440, 150, 25);

[Link](20, 470, 100, 30);

[Link](140, 470, 100, 30);

[Link](20, 550, 540, 25);

[Link](600, 800);

[Link](null);

[Link](true);

[Link](lblClass);

[Link](txtInput);

[Link](txtArea);

[Link](chkSE);

[Link](chkCS);

[Link](chkEE);

[Link](chkMor);

[Link](chkAft);

[Link](chCities);
[Link](btnRegister);

[Link](lblMsg);

[Link](btnClose);

@Override

public void actionPerformed(ActionEvent e){

if ([Link]().equals(btnRegister)) {

String classtext;

String shift;

String city;

classtext = [Link]();

if ([Link]() == true) {

shift = "Morning Shift";

else{

shift = "Afternoon Shift";

city = [Link]();

int r = 55;

[Link](classtext + " " + shift + " " + [Link](r));

else if ([Link]().equals(btnClose)){

// do what u want on Close

[Link]();

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

// TODO code application logic here

GUIApplication gui = new GUIApplication();

You might also like