A window (or frame) is specified by the coordinates of its upper-left corner (xw, yw) and its height (hw) and width (ww). The window height and width should be a third of the corresponding screen dimensions:
wh = sh/3The screen center's at (sw/2, sh/2); the window center's at (xw + ww/2, yw + wh/2)). Those two points should be the same, which gives
ww = sw/3
xw + ww/2 = sw/2which rewrites to
yw + wh/2 = sh/2
xw = sw/2 - ww/2See page 253 (7th ed.) or 290 (8th ed.).
yw = sh/2 - wh/2
Point2D
classes. Don't use any more syntax than
blahbut make sure what syntax you do use is complete enough to show the relations.class
blah{
blah}
Point2D
is a parent abstract class for the two
concrete classes Point2D.Float
and
Point2D.Double
. The interesting part about the
parent-child relation is that the children are static inner classes of the
parent (page 262 (7th ed.) or 300 (8th ed.)):
public class Point2D { public static class Point2D.Float extends Point2D { } public static class Point2D.Double extends Point2D { } }
This page last modified on 31 March 2008. |
|