0% found this document useful (0 votes)
2 views2 pages

Java Code

The document is a Java program that creates a graphical user interface using AWT components. It includes a button, label, text field, text area, list, choice, checkbox, and scrollbar, all arranged in a flow layout. The main method initializes and displays the ComponentExample frame.

Uploaded by

someshitty
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)
2 views2 pages

Java Code

The document is a Java program that creates a graphical user interface using AWT components. It includes a button, label, text field, text area, list, choice, checkbox, and scrollbar, all arranged in a flow layout. The main method initializes and displays the ComponentExample frame.

Uploaded by

someshitty
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

Import [Link].

*;

Public class ComponentExample extends Frame {

Public ComponentExample() {

setTitle(“Component Example”);

setSize(400, 400);

setLayout(new FlowLayout());

Button button = new Button(“Submit”);

Add(button);

Label label = new Label(“Enter text:”);

Add(label);

TextField textField = new TextField(15);

[Link](“Default text”);

[Link]();

add(textField);

TextArea textArea = new TextArea(5, 20);

[Link](“This is a text area.”);

[Link](false);

add(textArea);

List list = new List(4);

[Link](“Item 1”);

[Link](“Item 2”);

[Link](“Item 3”);
[Link](“Item 4”);

Add(list);

Choice choice = new Choice();

[Link](“Choice 1”);

[Link](“Choice 2”);

[Link](“Choice 3”);

Add(choice);

Checkbox checkbox = new Checkbox(“Check me!”);

Add(checkbox);

Scrollbar scrollBar = new Scrollbar([Link], 50, 10, 0, 100);

Add(scrollBar);

setVisible(true);

Public static void main(String[] args) {

New ComponentExample();

You might also like