Professional Documents
Culture Documents
Lesson 6 Diit PPT Dcit 50 Oop
Lesson 6 Diit PPT Dcit 50 Oop
Information Technology
LESSON
Java Swing
6
Prepared:
NATHANAEL F. BUENO
Department of Industrial and
Information Technology
Objectives
• Discuss the concept of GUI design in Java programming using
Swing
Department of Industrial and
Information Technology
The Swing library is built on top of the Java Abstract Widget Toolkit
(AWT)
Container Class
What is a container class?
Container classes are classes that can have other components on it. So for creating a GUI, we
need at least one container object. There are 3 types of containers.
1. Panel: It is a pure container and is not a window in itself. The sole purpose of a Panel is
to organize the components on to a window.
2. Frame: It is a fully functioning window with its title and icons.
3. Dialog: It can be thought of like a pop-up window that pops out when a message has to
be displayed. It is not a fully functioning window like the Frame.
Department of Industrial and
Information Technology
5 6
Department of Industrial and
Information Technology
GUI Building
Introduction to GUI Building
We will create a simple graphical user interface and add simple back-end
functionality. In particular we will go steps by steps on how to code the behavior of buttons and
fields in a Swing form, JFrame in particular. We will work through the layout and design of a
GUI and add a few buttons and text fields. The text fields will be used for receiving user input
and also for displaying the program output. The button will initiate the functionality built into
the front end. The application we create will be a simple display of information entered by the
user.