se1021-6-1-ReviewEventsStartExceptions

Download Report

Transcript se1021-6-1-ReviewEventsStartExceptions

SE-1021
Software Engineering II

Week 6, Class 1





Tomorrow:


Questions: Quiz? Lab? HW? Class? etc.
Exception Handling (missing slides from last time)
Exercise: Handling a simple exception
Exercise: Handling JOptionPain
Checked vs. Unchecked Exceptions
Wed. Lab

Quiz: Layouts (~25%), events (~25%), exceptions
(~50%)
1
Swing as a Framework
Your code
Swing
SE-1021
Dr. Josiah Yoder
Slide style: Dr. Hornick
2
Events

Where do events come from in Java?

JButton




Where do events go to in Java?

SE-1021
Dr. Josiah Yoder
Slide style: Dr. Hornick
3
Exception Handling Terms
Exception – An object thrown when a problem
occurs
Throw – Unwind the stack looking for a method
that called this one that can fix the problem.
Stack – A list of the method that called this
one, and the method that called the method
that called this one, etc.
Stack Trace – Printout of the current stack
SE-1021
Dr. Josiah Yoder
Slide style: Dr. Hornick
4
Exception Handling Terms
Handle an exception – Taking care of the
problem
1. “pass the buck”
Pass it on to the caller of this method.
2. Catch the exception.
Catch – Stop unwinding the stack and handle
the exception
(Yes, these are circular definitions. Hmmm…)
SE-1021
Dr. Josiah Yoder
Slide style: Dr. Hornick
5
(footnote)


SE-1021
Dr. Josiah Yoder
Slide style: Dr. Hornick
“pass the buck”
means give
someone else
responsibility for
handling a problem
President Truman
had a “Buck Stops
Here” sign
indicating he
“caught” the
6
exceptions…