| CSCI A201/A597Lecture Notes 18 Spring 2000 |
Let's review what we did last time. We looked at:
We also looked at the design stages of an application and at what it takes to transform it from a flow chart (or a diagram) into a program. The process is called implementation and it almost always has to come after the design phase. Very seldom it can be done at the same time with it, only when the problem is very simple. Issues of implementation need to be taken into account in the design phase, but the actual implementation, or coding in Java, can only take place after the design is done.
The diagram above is part of the planning process.
Here are some notations used:
xL is the x coordinate on the left of the grid
xR is the x coordinate on the right of the grid
yL is the y coordinate on the left of the grid
yR is the y coordinate on the right of the grid
xM is the y coordinate on a mouse click
yM is the y coordinate of a mouse click
w is the size of any of the squares that make up the grid
(x3, y1) is the top left corner of the square in line 3 column 1
11 and 7, and put any values
that you want in them, thus being able to work with any grid size you want.
It could be convenient to make a square grid in which case one variable
size could be all you need (and that should bring you memories
of the practical).
Now the design of the assignment.
xL,
yL, size and w
xM and yM.
xL, yL and w, make
the mouse report the column and the line of the square that it is being
clicked on (if any). If the mouse is clicked outside the grid report that.
w
positioned with the top left corner in the point where the mouse was
clicked. In step 6 change this positioning the red square properly.
Time permitting we will be showing you another application.
If we don't have time we'll just have to delegate that to the lab notes.