Topic 1 - Variables and Data Types
Topic 2 - Conditionals and Strings
Topic 3 - Loops
Topic 4 - Arrays
Topic 5 - File Handling
Semester 1 Projects
Topic 6 - Classes/Objects and Methods
Topic 7 - ArrayLists
Semester Projects

Part 1b: Create the Paddle

The next step is to create the paddle. At one level, this is considerably easier than the bricks. There is only one paddle, which is a filled GRect. You even know its position relative to the bottom of the window. The challenge in creating the paddle is to make it track the mouse. Mouse tracking makes use of the event-driven model discussed in this presentation.
Here, however, you only have to pay attention to the x coordinate of the mouse because the y position of the paddle is fixed.

The only additional wrinkle is that you should not let the paddle move off the edge of the window. Thus, you’ll have to check to see whether the x coordinate of the mouse would make the paddle extend beyond the boundary and change it if necessary to ensure that the entire paddle is visible in the window. This entire part of the program takes fewer than 10 lines of code, so it shouldn’t take so long.

You’ll want to use a method called mouseMoved() that helps draws the paddle, and places it in the desired initial position.

Make sure to watch the following presentation on how Mouse Tracking works: