You must
submit your answers using Blackboard by attaching the source
(i.e., .java
) files. Note: Enter "Lab" in the "Comments Area".
If you are unable to complete the assignment during the lab period it is strongly recommended that you complete it on your own.
usa48.txt
Painting.class
MapReader.java
Map.java
MapDriver.java
to your working directory.
Note that the file usa48.txt
contains a simplified
map of the 48 coterminous states in the United States. Each
state is represented as a single polygon -- islands, lakes, etc...
have been omitted for simplicity.
Map
class.
paint()
method in the Map
class so that it draws (i.e., strokes) all of the GeneralPath
objects in the Vector
named polygons.
MapDriver
class so that it:
MapReader
that will read from the
file named usa48.txt
Map
objectMapDriver
.
paint()
method in the Map
class so that it now also renders the title
"United States of America" at point 0,50 (in the current font).
Map
class and execute the
MapDriver
.
defaultFont
that is of
type Font
.
Map
class so that
defaultFont
is instantiated as an italicized
"Serif" font with a size of 50.
paint()
method in the Map
class so that it uses
defaultFont
.
Map
class and execute the
MapDriver
.
paint()
method in the Map
class so that it now also renders a title as close to the
top as it can be while still being completely visible.
(Hint: You will need to use the
Graphics.getFont()
method,
the Graphics2D.getFontRenderContext()
method,
Font.getLineMetrics(java.lang.String, java.awt.font.FontRenderContext)
and the
LineMetrics.getHeight()
methods in order to determine the baseline.)
Modify the classes above so that States with 0-100 fatalities are filled in green, 101-500 fatalities are filled in yellow, 501-1000 fatalities are filled in orange, and more than 1001 fatalities are filled in red.
Copyright 2006