• Midterm 3
– Monday 2/26/07
– Topics:
• Chapters 7 & 8
• How it works: bouncing ball program
• Timer, Mover, MoveTimer
• BorderLayout, FlowLayout, Button
• Let’s review the bouncing ball app
– BouncingBallApp
– BouncingBallPanel
– BouncingBall
– Mover
– MoveTimer
– SmartEllipse
• BouncingBallApp
– Wrapper of the BouncingBallPanel
– Doesn’t do much
• BouncingBallPanel
– implements Mover
• So there must be a move() method
– Objects contained:
• a BouncingBall
• a MoveTimer
– Important methods:
• paintComponent
• move -- has to call repaint()
• BouncingBall
– extends SmartEllipse
– Method move() – override or overload?
• Mover
– A simple interface
• Why do we need this?
• What if we don’t have this, can we still do the job? What do we need to modify?
– Specifies one method
– Can we make this into an abstract class?
• What could be a problem?
• MoveTimer
– extends javax.swing.Timer
– Concepts of inner class
• SmartEllipse
– Same thing you had before.
• Layouts
– BorderLayout, FlowLayout
No comments:
Post a Comment