uk.org.redfelineninja.risk.client
Class RiskMap

java.lang.Object
  |
  +--java.awt.Component
        |
        +--uk.org.redfelineninja.awt.PixMap
              |
              +--uk.org.redfelineninja.awt.ImageMap
                    |
                    +--uk.org.redfelineninja.risk.client.RiskMap
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class RiskMap
extends ImageMap

This class provides all the tools required to display any Risk map. It extends from ImageMap and therefore has all the abilities to detect mouse clicks and paint territories. It also displays a number associated with each country and can show selection graphically.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RiskMap(java.awt.Image img)
          Deprecated. This is dead code and should not be used
RiskMap(java.awt.Image img, java.util.Hashtable zones)
          Create a new image map using the supplied list of zones.
 
Method Summary
 int getArmies(java.lang.Object country)
          Get the number of armies in the supplied country.
 java.lang.Object getSelection()
          Get the currently selected country.
 void paint(java.awt.Graphics g)
          Paint as the super class and draw in the number of armies in each country and the selection.
 void setArmies(java.lang.Object country, int value)
          Set the number of armies in the supplied country.
 void setSelection(java.lang.Object country)
          Set the selection to the supplied country.
 
Methods inherited from class uk.org.redfelineninja.awt.ImageMap
addActionListener, getCountryColor, getOriginalCountryColor, paintZone, removeActionListener, toString
 
Methods inherited from class uk.org.redfelineninja.awt.PixMap
drawLine, floodFill, floodFillOld, getAutoRepaint, getColor, getColorModel, getImage, getMaximumSize, getMinimumSize, getPixel, getPixel, getPixels, getPreferredSize, loadImage, newPixels, newPixels, setAutoRepaint, setColor, setColor, setColorModel, setPixel, setPixel
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RiskMap

public RiskMap(java.awt.Image img)
Deprecated. This is dead code and should not be used

Hardcoded contructor to play classic Risk. This expects to be given the standard Risk arena map.

This contructor is not used by any Risk Arena components. It remains becasue there is still some test code that uses the code here.


RiskMap

public RiskMap(java.awt.Image img,
               java.util.Hashtable zones)
Create a new image map using the supplied list of zones.

Method Detail

setArmies

public void setArmies(java.lang.Object country,
                      int value)
Set the number of armies in the supplied country. The supplied country must exist.


getArmies

public int getArmies(java.lang.Object country)
Get the number of armies in the supplied country. The supplied country exist.


setSelection

public void setSelection(java.lang.Object country)
Set the selection to the supplied country. The supplied country must exist.


getSelection

public java.lang.Object getSelection()
Get the currently selected country.


paint

public void paint(java.awt.Graphics g)
Paint as the super class and draw in the number of armies in each country and the selection.

Overrides:
paint in class PixMap
See Also:
PixMap.getImage()