Event Driven/GUI Programming Week1-2

0.0(0)
studied byStudied by 5 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/171

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

172 Terms

1
New cards
Non-GUI applications
console based
2
New cards
Non-GUI applications
application has control at all stages of execution
3
New cards
Non-GUI applications
user's interaction with the application is pre-programmed
4
New cards
Non-GUI applications
application calls to the OS to execute built in language modules
5
New cards
GUI Applications
Application that is windows/forms-based
6
New cards
GUI Applications
non-sequential program execution
7
New cards
GUI Applications
Event Driven
8
New cards
Event Driven
Application sits in a process loop waiting for an event to occur/execute
9
New cards
GUI Applications
Application receives message from the OS that an event has occurred
10
New cards
Event
a notification from the OS that an action has occurred
11
New cards
Event
this needs to be registered to work
12
New cards
Event Handler
methods that tell what should be done when an event occurs
13
New cards
Event Handler
their order of executions differ in every program execution
14
New cards
Event-Driven Programming
It involves a new type of flow-of-controls - events
15
New cards
Event-Driven Programming
It is asynchronous. They manifest themselves by altering the state of the execution environment. They are detected through this change.
16
New cards
Control Structure is inverted
system has control, not the application
17
New cards
System
It waits for an event then calls the appropriate routine in the application
18
New cards
a set of classes (widgets)
they can detect user's input
19
New cards
listeners or event handlers
define what the system will do in response to an event
20
New cards
Java Foundation Classes (JFC)
a set of GUI components for Java applications
21
New cards
Java Foundation Classes (JFC)
encompasses a group of features for building Graphical User Interface (GUI)
22
New cards
Java Foundation Classes (JFC)
adds rich graphics functionality and interactivity to Java Applications
23
New cards
Features of
Java Foundation Classes (JFC)
-Swing GUI Components
-Pluggable Look-and-Feel Support
-Accessible API
-Java 2D API
-Internalization
24
New cards
Java Abstract Window Toolkit
an API to develop GUI or window-based applications in Java
25
New cards
java.awt
the package provides classes such as Text Field, Label, TextArea, RadioButton, CheckBox, Choice, List, etc.
26
New cards
Java Abstract Window Toolkit
Maps general Java code to each operating system's real GUI System
27
New cards
Java Swing
part of Java Foundation Classes (JFC) that is used to create window-
based applications
28
New cards
Java Swing
built on the top of AWT (Abstract Windowing Toolkit) API and entirely written in java
29
New cards
Java Swing
Paints GUI controls itself pixel-by-pixel rather than handing off to OS.
30
New cards
Java Swing
Unlike AWT, it provides platform-independent and lightweight components.
31
New cards
Java Swing
package provides classes for it such as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu, JColorChooser etc
32
New cards
AWT
AWT vs Swing:
Components are platform dependent
33
New cards
AWT
AWT vs Swing:
Components are heavyweight
34
New cards
AWT
AWT vs Swing:
Doesn’t support pluggable look and feel
35
New cards
AWT
AWT vs Swing:
Provides less components than Swing
36
New cards
AWT
AWT vs Swing:
Doesn’t follow MVC design architecture
37
New cards
Swing
AWT vs Swing:
Components are platform independent
38
New cards
Swing
AWT vs Swing:
Components are lightweight
39
New cards
Swing
AWT vs Swing:
Supports pluggable look and feel
40
New cards
Swing
AWT vs Swing:
Provides more powerful components
41
New cards
Swing
AWT vs Swing:
Follows MVC design architecture
42
New cards
Model-View-Controller Pattern
Software architecture pattern that separates the model, the user- interface and control logic of an application in three distinct components
Software architecture pattern that separates the model, the user- interface and control logic of an application in three distinct components
43
New cards
Model
(MVC)
Representation of domain data
44
New cards
Model
(MVC)
Business logic
45
New cards
Model
(MVC)
Persistence mechanism
46
New cards
View
(MVC)
User interface
47
New cards
View
(MVC)
Interaction elements
48
New cards
Controller
(MVC)
Intermediary between the Model and View
49
New cards
Controller
(MVC)
Maps user actions to model actions
50
New cards
Benefits of MVC
• Organization
• Rapid Application Development
• Code reuse
Parallel development
• Presents the same information in different ways
• The views and application behavior should reflect the manipulations of data immediately
• Allows different user interface standards or port it to other environments where the application codes should not be affected.
51
New cards
1
MVC Control Flow (1-5)
The user performs an action on the interface
52
New cards
2
MVC Control Flow (1-5)
The controller takes the input event
53
New cards
3
MVC Control Flow (1-5)
The controller notifies the user action to the model which may involve a change of the model’s state
54
New cards
4
MVC Control Flow (1-5)
It generates a new view. The view takes the data model.
55
New cards
5
MVC Control Flow (1-5)
The user interface waits for another user interaction, which starts a new cycle.
56
New cards
Model
MVC and Java GUI
• made by the programmer/developer
57
New cards
View
MVC and Java GUI
• set of objects of classes that inherit from java.awt.Component
58
New cards
Controller
MVC and Java GUI
• The event processing thread which captures and propagates the event to the view and model.
59
New cards
Controller
MVC and Java GUI
• Uses classes of events that implement EventListener type interfaces (e.g.
ActionListener)
60
New cards
Window
Java GUI Application Components
• The top-level container.
• Examples: frame, dialog box
61
New cards
Component/Control
Java GUI Application Components
• A GUI widget that resides in a window.
• Examples: button, text box, label
62
New cards
Container
Java GUI Application Components
• A logical grouping for storing components.
• Examples: panel, box
63
New cards
JLabel
The class can display either text, an image, or both.
64
New cards
Display
Label's contents are aligned by setting the vertical and horizontal alignment in its ____ area
65
New cards
vertically centered
By default, labels are ______ in their display area
66
New cards
Text-only
____ labels are leading edge aligned by default
67
New cards
image-only
_____ labels are horizontally centered by default
68
New cards
JButton
an implementation of a push button
69
New cards
JToggleButton
a two-state button typically used on toolbars to indicate the state of a toggleable (on/off) option, such as the bold, italic and underline font attributes that are enabled when using a word processor
70
New cards
Imagelcon
an implementation of the Icon interface that paints Icons from Images
71
New cards
JTextField
a component which allows the editing of a single line of text.
72
New cards
JPassword Field
a component which is specialized to handle password functionality and allows the editing of a single line of text.
73
New cards
JTextArea

a multi-line area to display plain text
74
New cards
Events
______ are generated as a result of user interaction with the graphical user interface components such as clicking on a button, moving the mouse, entering a character through keyboard, selecting an item from the list, etc
75
New cards
Event Handling
is the mechanism that controls the event and decides what should happen if an event occurs.
76
New cards
Event Handler
This mechanism has a code which is known as an ______, that is executed when an event occurs.
77
New cards
Delegation Event Model
Java uses the _______ to handle the events. This model defines the standard mechanism to generate and handle the events
78
New cards
Foreground Events
These events require direct interaction of the user.
79
New cards
Foreground Events
These events are generated as consequences of a person interacting with the graphical components in the Graphical User Interface
80
New cards
Background Events
These events require indirect interaction of the end user
81
New cards
Background
Operating system interrupts, hardware or software failure, timer expiration, and operation completion are some examples of _______ events
82
New cards
Foreground
clicking on a button, moving the mouse, entering a character through keyboard, selecting an item from list, scrolling the page are some examples of _____ events
83
New cards
Source
_____ is an object on which the event occurs
84
New cards
Source
responsible for providing information of the occurred event to it's handler
85
New cards
Listener
It is also known as event handler
86
New cards
Listener
responsible for generating a response to an event
87
New cards
Listener
________ is an object that waits until it receives an event. Once the event is received, the ________ processes the event and then returns (one word)
88
New cards
Listener
In this model, the ______ needs to be registered with the source object so that the listener can receive the event notification
89
New cards
ActionEvent
Is generated when button is clicked or the item of a list is double-clicked
90
New cards
KeyEvent
On entering the character the ______ is generated
91
New cards
MouseEvent
This event indicates that a mouse action occurred in a component. This low-level event is generated by a component object for Mouse Events and Mouse motion events
92
New cards
WindowEvent
This low-level event is generated by a Window object when it is opened, closed, activated, deactivated or when the focus is transferred into or out of the Window
93
New cards
MouseMotion Event
indicates a mouse action occurred in a component. This low-level event is generated by a component object when a mouse is dragged or moved
94
New cards
PaintEvent
The object of this class represents the change in the state of a window
95
New cards
EventListener
represent the interfaces responsible to handle events
96
New cards
EventListener
It is a marker interface which every listener interface has to extend.
97
New cards
EventListener
This class is defined in java.utiI package
98
New cards
ActionListener
used for receiving the action events
99
New cards
ItemListener
used for receiving the item events
100
New cards
KeyListener
used for receiving the key events