Java Programming With GUI Report

16
Java Programming with GUI Prepared by: Efril Datulaita Sunshine Agos Angelic Nillo

description

OOP

Transcript of Java Programming With GUI Report

Page 1: Java Programming With GUI Report

Java Programmingwith GUI

Prepared by:Efril DatulaitaSunshine AgosAngelic Nillo

Page 2: Java Programming With GUI Report

Java Programmingwith GUI

› What is GUI› Basic GUI objects› Abstract Window Toolkit› Swing› Swing Components

Page 3: Java Programming With GUI Report

WHAT IS GUI ? Pronounced as (goo-ee) GUI stands for Graphical User

Interface Displays a graphical images(text

boxes, buttons, and icons) on the screen that the user can interact or manipulate with devices such as mouse.

Page 4: Java Programming With GUI Report

WHAT IS GUI ? A GUI obtains information from the

user and gives it to the program for processing. When the program is finished processing information, the GUI gives the result to the user, usually in some sort of window.

A GUI is built by putting components into containers.

Page 5: Java Programming With GUI Report

BASIC GUI OBJECTSWINDOW

MENU

BUTTON

TEXT BOX

LABEL

Page 6: Java Programming With GUI Report

BASIC GUI OBJECTS

WINDOW› A window is a (usually) rectangular portion

of the display on a computer monitor that presents its contents (e.g., the contents of a directory, a text file or an image) seemingly independently of the rest of the screen.

LABEL› Displays unselectable texts or images

Page 7: Java Programming With GUI Report

BASIC GUI OBJECTSMenu

› A list of alternatives offered to the user, usually by offering a list of names.

› provides a space-saving way to let the user choose one of several options.

Button› A button that is simply something that

looks like a button to be pushed and that typically has a label.

Page 8: Java Programming With GUI Report

BASIC GUI OBJECTS

Text Box› A text box's purpose is to allow the user to

input text information to be used by the program.

› Display selectable text and, optionally, allow the user to edit the text. 

Page 9: Java Programming With GUI Report

ABSTRACT WINDOW TOOLKIT Abstract Window Toolkit (AWT) is a

collection of graphical user interface (GUI) components (widgets) and other related services required for GUI programming in Java.

AWT was platform dependent, which means a program written in AWT behaves differently in different platforms.

Page 10: Java Programming With GUI Report

AWT components require the resources of the operating system on which they are installed

They are called heavyweight components.

ABSTRACT WINDOW TOOLKIT

Page 11: Java Programming With GUI Report

Basic objects derived from Components in package java.awt :› Button

Used to trigger actions and other events. Button btn1=new Button();

› Checkbox Item that can be in either an “on”(true) or

“off”(false) state. Checkbox box = new Checkbox();

› Label Used to show the text or string in an application

and label never perform any type of action. Label lab1 = new Label():

ABSTRACT WINDOW TOOLKIT

Page 12: Java Programming With GUI Report

› List Presents the user with a scrolling list of text items.  List lists = new List(5);

› Scrollbar Provides a convenient means for allowing a user to

select from a range of values. Scrollbar sb = new Scrollbar();

› TextArea A text container component, contains plain text. TextArea inputArea = new TextArea();

› TextField A text container component, contains single line and

limited text information. TextField nf = new TextField();

ABSTRACT WINDOW TOOLKIT

Page 13: Java Programming With GUI Report

SWING A swing application developed on

one platform behaves the same on any other platform in which Java is installed. Extends capabilities in Abstract Window Toolkit (AWT)

Swing gives far more options for everything (buttons with pictures on them, etc.)

Page 14: Java Programming With GUI Report

SWING COMPONENTS

Swing components are platform independent, requiring only the Java runtime system to function.

They are called lightweight components.

Names of the Swing GUI components are almost similar to that of AWT

Page 15: Java Programming With GUI Report

SWING COMPONENTS Basic objects that mirror the AWT

components› JButton

Jbutton btn = new Jbutton();

› JCheckBox cb=new JCheckBox();

› JLabel JLabel jlb = new JLabel();

Page 16: Java Programming With GUI Report

SWING COMPONENTS

› Jlist JList dataList = new JList(data);

› JScrollbar JScrollPane scrollPane = new JScrollPane();

› JTextArea JTextArea resultArea = new JTextArea();

› JTextField JTextField txt = new JTextField();