A layout manager is an object that
implements the LayoutManager interface and
determines the size and position of the
components within a container.
Although components can provide size and
Action Listeners/Swing Events
Every time a user interacts with a component,
an event is triggered.
To deal with these events, an event handler is
Action listeners are probably the easiest
Introduction to Swing
What is Swing
When Java was first created, AWT was the
toolkit developed to create graphical user
AWT used underlying native subroutines to
create its graphics and would therefore look
like a nativ
Mouse Event Handling
Mouse events notify when the user uses the
mouse (or similar input device) to interact
with a component.
Mouse events occur when the cursor enters or
exits a component's onscreen area and when
Model View Controller
What is MVC?
Modelviewcontroller (MVC) is a software
architecture pattern that separates the
representation of information from the user's
interaction with it.
The central idea behind MVC is code
Graphical User Interfaces
First GUI Systems
Graphical User Interface (GUI) history covers five
decades of incremental refinements built upon the
same core principles of using windows, icons, menus,
and a pointing device (
Coding and Debugging in
In NetBeans, to use the debugger correctly, we first
must set a break point.
Setting up a JFrame
All Graphical User Interfaces require some
kind of main application frame in which to
display. In Swing, this is an instance of
Our first step is to therefore create a program
Labels and Buttons
With the JLabel class, you can display
unselectable text and images.
If you need to create a component that
displays a string, an image, or both, you can
do so by using or extending JLabel.
If the compone