0% found this document useful (0 votes)
52 views2 pages

Java AWT Event Handling Exam Notes

This document covers Java AWT and event handling, detailing the mechanisms of event generation and processing through event sources, classes, and listeners. It discusses various types of events, user interface components, containers, graphics, and layout managers. Key points for exams include the delegation event model, differences between AWT and Swing, and advantages of adapter classes.

Uploaded by

jnaneswariganja
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views2 pages

Java AWT Event Handling Exam Notes

This document covers Java AWT and event handling, detailing the mechanisms of event generation and processing through event sources, classes, and listeners. It discusses various types of events, user interface components, containers, graphics, and layout managers. Key points for exams include the delegation event model, differences between AWT and Swing, and advantages of adapter classes.

Uploaded by

jnaneswariganja
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT – IV : JAVA AWT & EVENT HANDLING (Exam Notes)

1. Event Handling
Event handling is the mechanism that controls actions like mouse click, key press, etc. An event is
generated when the user interacts with a GUI component.

2. Events
An event is an object that describes a change in the state of a source. Example: Button click,
mouse movement, key press.

3. Event Sources
Event source is the component that generates the event. Examples: Button, TextField, Checkbox,
List.

4. Event Classes
Event classes represent the event object. Common event classes: • ActionEvent • MouseEvent •
KeyEvent • WindowEvent • ItemEvent

5. Event Listeners
Event listener is an interface that receives and processes events. Examples: • ActionListener •
MouseListener • KeyListener • WindowListener

6. Delegation Event Model


In this model, the event source delegates event handling to listener objects. Steps: 1. Event source
generates event 2. Event object created 3. Listener receives and handles event

7. Mouse Events
Handled using MouseListener and MouseMotionListener. Methods: • mouseClicked() •
mousePressed() • mouseReleased() • mouseEntered() • mouseExited()

8. Keyboard Events
Handled using KeyListener. Methods: • keyPressed() • keyReleased() • keyTyped()

9. Adapter Classes
Adapter classes provide default implementations of listener interfaces. Examples: • MouseAdapter •
KeyAdapter • WindowAdapter

10. AWT Class Hierarchy


Object → Component → Container → Panel / Window → Frame / Dialog / Applet

11. User Interface Components


• Label – displays text • Button – clickable button • Canvas – drawing area • Scrollbar –
horizontal/vertical scrolling • TextField – single-line input • TextArea – multi-line input • Checkbox –
on/off option • CheckboxGroup – radio buttons • Choice – drop-down list • List – list of items
12. Containers
• Panel – simple container • ScrollPane – scrollable container • Dialog – pop-up window • MenuBar
– menus in frame

13. Graphics
Graphics class is used to draw shapes. Methods: • drawLine() • drawRect() • drawOval() •
drawString()

14. Layout Manager


Layout manager controls component positioning.

15. Types of Layout Managers


• FlowLayout – left to right • BorderLayout – North, South, East, West, Center • GridLayout – rows
and columns • CardLayout – multiple screens • GridBagLayout – flexible grid system

IMPORTANT EXAM POINTS


• Define delegation event model • Difference between AWT and Swing • Mouse and keyboard
events • Layout manager types • Adapter classes advantages

You might also like