support.Flight
Class Map

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--support.Flight.Map

class Map
extends java.awt.Canvas
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Class that displays a map of the USA, draws vertices and edges on it when asked, and reports mouse interaction with the vertices. Tightly tied to GUI.java.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
private  java.awt.Image background_
           
private  GUI client_
           
private  Dictionary edges_
           
(package private) static int HEIGHT
           
private static boolean ibShouldSleep
           
(package private) static java.lang.String MAP_IMAGE
           
private  java.awt.Image offscreen_
           
(package private) static int RADIUS
           
(package private) static int SIDE
           
private  Dictionary vertices_
           
(package private) static int WIDTH
           
 
Fields inherited from class java.awt.Canvas
base, graphicsConfig, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
(package private) Map(GUI client)
           
 
Method Summary
(package private) static void ()
           
(package private)  void clearEdges()
           
(package private)  void clearVertices()
           
(package private)  void drawAirport(AirportSpecs a, java.awt.Color c)
           
(package private)  void drawAllAirports(java.awt.Color c)
           
private  void drawEdge(GUIEdge ge, java.awt.Graphics g)
           
(package private)  void drawFlight(FlightSpecs f, java.awt.Color c)
           
private  void drawVertex(GUIVertex gv, java.awt.Graphics g)
           
 void mouseClicked(java.awt.event.MouseEvent me)
           
 void mouseDragged(java.awt.event.MouseEvent me)
           
 void mouseEntered(java.awt.event.MouseEvent me)
           
 void mouseExited(java.awt.event.MouseEvent me)
           
 void mouseMoved(java.awt.event.MouseEvent me)
           
 void mousePressed(java.awt.event.MouseEvent me)
           
 void mouseReleased(java.awt.event.MouseEvent me)
           
 void paint(java.awt.Graphics graphics)
           
 void repaint()
           
 void update(java.awt.Graphics g)
           
(package private)  GUIVertex vertexAt(int x, int y)
           
 
Methods inherited from class java.awt.Canvas
addNotify, constructComponentName, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

WIDTH

static final int WIDTH

HEIGHT

static final int HEIGHT

RADIUS

static final int RADIUS

SIDE

static final int SIDE

MAP_IMAGE

static final java.lang.String MAP_IMAGE

ibShouldSleep

private static boolean ibShouldSleep

client_

private GUI client_

background_

private java.awt.Image background_

offscreen_

private java.awt.Image offscreen_

vertices_

private Dictionary vertices_

edges_

private Dictionary edges_
Constructor Detail

Map

Map(GUI client)
Method Detail

static void ()

vertexAt

GUIVertex vertexAt(int x,
                   int y)

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent me)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

drawAirport

void drawAirport(AirportSpecs a,
                 java.awt.Color c)

drawVertex

private void drawVertex(GUIVertex gv,
                        java.awt.Graphics g)

drawFlight

void drawFlight(FlightSpecs f,
                java.awt.Color c)

drawEdge

private void drawEdge(GUIEdge ge,
                      java.awt.Graphics g)

clearEdges

void clearEdges()

clearVertices

void clearVertices()

drawAllAirports

void drawAllAirports(java.awt.Color c)

update

public void update(java.awt.Graphics g)
Overrides:
update in class java.awt.Component

repaint

public void repaint()
Overrides:
repaint in class java.awt.Component

paint

public void paint(java.awt.Graphics graphics)
Overrides:
paint in class java.awt.Canvas