Chapter 04
Chapter 04
CHAPTER#-04
Java Programming Chapter 04
Swing Controls
Java Programming Chapter 04
• Swing Controls
• Every user interface considers the following three main aspects:
• UI elements : These are the core visual elements the user eventually sees
and interacts with.
• SWING provides a huge list of widely used and common elements varying
from basic to complex which we will cover in this tutorial.
• Layouts: They define how UI elements should be organized on the screen
and provide a final look and feel to the GUI (Graphical User Interface). This
part will be covered in Layout chapter.
• Behavior: These are events which occur when the user interacts with UI
elements. This part will be covered in Event Handling chapter.
Java Programming Chapter 04
Swing Controls
Java Programming Chapter 04
Event
What is an Event?
• Change in the state of an object is known as event i.e. event
describes the change in state of source.
• Events are generated as result of user interaction with the graphical
user interface components.
• For example, clicking on a button, moving the mouse, entering a
character through keyboard , selecting an item from list, scrolling the
page are the activities that causes an event to happen
Java Programming Chapter 04
Event
Types of Event
The events can be broadly classified into two categories:
• Foreground Events - Those events which require the direct interaction of user.
• They are generated as consequences of a person interacting with the graphical components
in Graphical User Interface.
• For example, clicking on a button, moving the mouse, entering a character through
keyboard, selecting an item from list, scrolling the page etc.
• Background Events - Those events that does not require the interaction of end user are
known as background events.
• Operating system interrupts, hardware or software failure, timer expires, an operation
completion are the example of background events.
Java Programming Chapter 04
JPasswordField Class
The class JPasswordField is a component which is specialized to handle
password functionality and allows the editing of a single line of text.
Java Programming Chapter 04
JPasswordField Class
Java Programming Chapter 04
Thought of Day
الزم نیست حتما عالی باشی تا شروع کنی ،ولی حتما
.باید شروع کنی تا بتوانی عالی باشی