Java Reference
In-Depth Information
package
moro;
import
java.io.*;
import
java.awt.*;
public class
Obstacle {
String name;
boolean
opaque;
Polygon polygon
#
new
Polygon();
public
Obstacle() { }
// parses a line of the XML input file
public boolean
parseXML(String line,
BufferedReader lineReader) { ...}
public void
paint(Graphics g) {
// paints this obstacle
((Graphics2D) g).fillPolygon(polygon);
}
}
Class
Environment
extends the
JPanel
class of the Java Swing framework
to implement the graphical window that displays the robot's operational
Figure 10.12
The graphical representation of the simulated environment.
Copyright ©
2005 Sun Microsystems, Inc. All rights reserved. Reproduced by permission of Sun Microsystems, Inc.