ZapMap - SOURCE OUTLINE
The embedded applet consists of 12 classes
(and an interface) within nine files:
ZapPanel.java
public class ZapPanel extends Applet {
private ZapPlaces theCanvas;
private ZapControls theControls;
private ZapData theData;
public void init() {
public void start () {
public Insets insets() {
public boolean keyDown (Event e, int theKey) {
public boolean mouseDown (Event e, int x, int y) {
ZapPlaces.java
class ZapPlaces extends ZapNames {
ZapPlaces (String catSelect, String placeSelect) {
public void setDataArrays (String dataName) { // CALLED BY ZAPFRAME AND ZAPDATA
public void setCategory (String catSelect) { // ALSO CALLED BY ZAPCONTROLS
public void zapOnePlace (String placeSelect) { // CALLED BY ZAPCONTROLS, ZAPPANEL
public synchronized void showPlaces (boolean placeNamesFlag) { // CALLED BY ZAPCONTROLS, ZAPPANEL
private synchronized void updateSpotArray () {
public synchronized void zapSpots () { // ALSO CALLED BY ZapControls,ZapPanel
public void paint (Graphics g) {
public synchronized void paintSpots() { // ALSO CALLED IN ZAPCONTROLS AFTER SHOWNAMES
private void drawSpot (Graphics g, Spot theSpot) {
private void drawPlaceName (Graphics g, String theName, int x, int y) {
private void markSpot (Graphics g, Spot theSpot, Color markColor) {
public synchronized boolean mouseDown (Event e, int x, int y) {
public synchronized boolean mouseMove (Event e, int x, int y) {
private String homePage (PlaceClass thePlace) {
private void goUrl (PlaceClass thePlace) {
private boolean withinBounds (int x, int y) {
ZapNames.java
class ZapNames extends ZapStreets {
ZapNames () {
public void showNames (boolean showNames) { // CALLED BY ZAPPLACES
public void paint (Graphics g) {
private void paintNames() {
private void paintName (
public boolean mouseDown (Event e, int x, int y) {
private int closestLine (int x, int y) {
ZapStreets.java
class ZapStreets extends Canvas {
ZapStreets () {
protected DataArrays getDataArrays (String dataName) { // CALLED BY ZAPPLACES
private String firstWord (String dataName) {
public void paint (Graphics g) {
public void updateLineArray() { // ALSO CALLED BY ZAPPLACES AND ZAPCONTROLS
private boolean withinBounds (StreetClass theStreet) {
public int convertX (float theCoord) { // ALSO CALLED BY ZAPPLACES
public int convertY (float theCoord) { // ALSO CALLED BY ZAPPLACES
private float revertX (int x) {
private float revertY (int y) {
public void zoomScreen (double screenScale) {
public boolean mouseMove (Event e, int x, int y) {
public boolean mouseDown (Event e, int x, int y) {
public boolean commandKey (Event e) {
public boolean mouseExit (Event e, int x, int y) {
public boolean arrowKey (Event e) {
public void setPickCenterFlag (boolean pickCenterFlag) { // CALLED IN ZAPCONTROLS
private void translateScreen (int x, int y) {
private void transform (Point screenTranslate, double screenScale) {
private final String coordString (int x, int y) {
private final String coordSubString (int theInt) {
public boolean setCenter (double centerX, double centerY) { // CALLED BY ZAPPLACES,ZAPPANEL
public void setScale (double scale) { // CALLED BY ZAPPANEL
public final void drawCenterLines () { // CALLED BY ZAPCONTROL
public final void showStatusString (String theString) { // ALSO CALLED BY ZAPPLACES
private final void drawCenterLines (Graphics g) { // PICK CENTER
ZapControls.java
class ZapControls extends Panel {
ZapControls (ZapPlaces theCanvas) {
public void setButtonBackgrounds () { // CALLED BY ZAPPANEL OR ZAPFRAME
public void addCatChoice (String[] catArray, String catSelect) { // CALLED BY ZAPPLACE
public void addPlaceChoice (PlaceClass[] placeArray, Spot [] spotArray, String placeSelect) {
public boolean action (Event e, Object object) {
public void undoPick() { // ALSO CALLED IN ZAPSTREETS
ZapData.java
class ZapData extends Panel {
DATA MEMBERS
ZapData (ZapPlaces theCanvas) {
public boolean action(Event e, Object arg) {
StreetClass.java
class StreetClass {
String name;
float coords[] = new float[4];
byte laneSize;
StreetClass () {}
StreetClass (
class LineDynamic {
public int x, y, dx, dy; // CENTER AND DIMENSION
protected int checkLine (Line theLine) {
class PlaceClass {
String placeName, placeURL, categories;
float x, y;
PlaceClass (String placeName, String placeURL, String categories, double x, double y) { // CALLED BY PLACESARRAYS
class Spot {
public boolean marked;
public boolean named = true;
public int x, y;
public int placeIndex;
interface DataArrays {
public String[] getCatArray();
public PlaceClass[] getPlaceArray();
public StreetClass[] getStreetArray();
class Line {
public boolean nameFlag = false;
public int x1, y1, x2, y2;
Empty.java
public class Empty implements DataArrays {
static final String[] catArray = {};
private static final PlaceClass[] placeArray = {};
private static final StreetClass[] streetArray = {};
public StreetClass[] getStreetArray() {
public String[] getCatArray() {
public PlaceClass[] getPlaceArray() {