0% found this document useful (0 votes)
5 views

Share Graphical User Interface (GUI) in JAVA

Uploaded by

febiba1449
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Share Graphical User Interface (GUI) in JAVA

Uploaded by

febiba1449
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Graphical User Interface (GUI)

In JAVA

Submitted By :- Abhishek Kumar


Prasad
Sub :- Evaluation Of Internship-1
Branch :- CSE
Regd No :- 2001109157
Semester :- 3rd
CONTENTS:
3. Certificate Of Course Completion
4. What is GUI
5. GUI Packages & Technologies
6. GUI Components
7. Classification of GUI Classes
8. Swing Control Components
9. LayoutManagers
10. Project
11. Thank You
GUI

• The Graphical User Interface is a form of user interface


that allows user to interact with electronic devices
through graphical icons and audio indicator such as
primary notations, instead labels or text navigation.
• It supports in all programming languages.
• It is made up of graphical components(eg. buttons, labels,
windows) through which the user can interact with the
page or application.
GUI Packages
AWT:-
• The AWT Component classes are provided by the java.awt
package.
• The Components used in AWT are mainly dependent on
the operating system.
• Java AWT needs a higher amount of memory for the
execution.
• Java AWT is slower than swing in terms of performance.
• Java AWT stands for Abstract Window Toolkit.
GUI Packages
SWING:-
• The Swing component classes are provided by the
javax.swing package.
• The Components used in Swing are not dependent on the
operating system. It is completely scripted in Java.
• Java Swing needs less memory space as compared to Java
AWT.
• ava Swing is faster than the AWT.
• Java Swing is mainly referred to as Java Foundation
GUI Components
AWT Control Components:- SWING Control Components:-
• TextField • JTextField
• TextArea • JTextArea
• Button • JButton
• List • JRadioButton
• CheckBox • JComboBox
• Choice • Jlist
• Lables • Jmenu
Classification Of GUI Classes

• Container Classes:-Any class which has other components in it is


called as a container class. For building GUI applications at least one
container class is necessary.
• Following are the three types of container classes:
1.Panel – It is used to organize components on to a window
2.Frame – A fully functioning window with icons and titles
3.Dialog – It is like a pop up window but not fully functional like the frame

Ex-Browser is a window(container) containing buttons, menus, slides, icons


and other GUI components.
Classification Of GUI Classes

AWT and SWING Classes:-


AWT:-
• Contains the fundamental classes used for constructing GUIs.
• AWT classes: Button, Canvas, and Container inherited from
component class
SWING:-
• Swing Jcomponent(derived from AWT container class)
• Swing Jframe(from AWT Frame Class)
Classification Of GUI Classes

GUI Helper Classes:-


Used by components and container to draw and place
objects
• Graphics-Abstract class for drawing strings , lines and
simple shapes
• Color-Specifies colors of GUI component
• Font-Specifies fonts for the text and drawing on GUI
components
Swing Control Components
JTextField:-The JTextField component allows the user to
type some text in a single line. It basically inherits the
JTextComponent class.
Example- JTextField txtBox = new JTextField();
Swing Control Components
JTextArea:-The JTextArea component allows the user to
type the text in multiple lines. It also allows the editing of
multiple-line text. It basically inherits the JTextComponent
class.
Example- JTextArea txtArea = new JTextArea(“This text
is default text for text area.”);
Swing Control Components
Jbutton:- This component can be used to perform some
operations when the user clicks on it. When the button is
pushed, the application results in some action. It basically
inherits the AbstractButton class.
Example- JButton okBtn = new JButton(“Ok”);
Swing Control Components
JRadioButton:-This component allows the user to select
only one item from a group item. By using the JRadioButton
component you can choose one option from multiple
options.
Swing Control Components
JComboBox:-This component will display a group of items as a
drop-down menu from which one item can be selected. At the top
of the menu the choice selected by the user is shown. It basically
inherits JComponent class.
Example:-String[] cityStrings ={ "Mumbai", "London", "New
York", "Sydney”};
JComboBox cities = new JComboBox(cityList);
Swing Control Components
Jlist:- The object of JList class represents a list of text items.
The list of text items can be set up so that the user can choose
either one item or multiple items. It inherits JComponent class.
Jmenu:- The JMenuBar class is used to display menubar on the
window or frame. It may have several menus.
• The object of JMenu class is a pull down menu component
which is displayed from the menu bar. It inherits the
JMenuItem class.
Swing Control Components
Jlabel:-The object of JLabel class is a component for placing text
in a container. It is used to display a single line of read only text.
The text can be changed by an application but a user cannot edit
it directly. It inherits JComponent class.
LayoutManagers
The LayoutManagers are used to arrange components in a
particular manner. The Java LayoutManagers facilitates us
to control the positioning and size of the components in GUI
forms.
Kind Of LayoutManagers:-
BorderLayout:-The BorderLayout is used to arrange the
components in five regions: north, south, east, west, and
center. Each region (area) may contain one component
only.
LayoutManagers
GridLayout:-The Java GridLayout class is used to arrange the
components in a rectangular grid. One component is displayed in
each rectangle.

FlowLayout:-The Java FlowLayout class is used to arrange the


components in a line, one after another (in a flow). It is the
default layout of the applet or panel.
Project

You might also like