Lecture 3
In preparation for today's class, you should have done exercises 01-07 of this collection of
Java exercises.
In class, I will start by taking questions from these exercises, and then move on to new ones: 08-10.
What did we learn so far, where are we going next?
- Writing code in an object oriented fashion:
- everything is inside some class, which defines what an object of that type looks like.
- objects are created with new.
- methods (functions) are applied to objects using the dot notation.
- the current class is referred to (within itself) with this.
- Basic Graphical User Interface (GUI) objects:
- button
- text box
- canvas
- label
- Basic Graphics objects:
- circle, rectangle
- text, fomt
- color, background color
- Writing code in an event-driven programming environment:
- the program must specify which events are to be expected (repainting of the applet, button clicks, etc.). Next time we will
learn also about mouse clicks.
- the program must specify code to implement certain event-handling methods: actionPerformed. Next time we also learn
about methods to handle mouse events (mousePressed, actionPerformed, etc.), by
writing a separate event handles (e.g. MouseHandler extending MouseAdapter).
- the program must implement certain methods which are always executed when certain events occur (init, paint, etc.)
Blackboard pictures