org.gjt.universe.gui
Class MapComponentJFC

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.gjt.universe.gui.MapComponentJFC
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.util.Observer, java.io.Serializable

public class MapComponentJFC
extends javax.swing.JComponent
implements java.util.Observer

MapComponentJFC.java Created: Thu Jun 10 10:04:47 1999 Modified: Sat Apr 28, 2001 (Dave Butler)

Version:
$Id: MapComponentJFC.java,v 1.12 2001/07/07 22:50:03 emeade Exp $
Author:
Shalon Wood
See Also:
Serialized Form

Nested Class Summary
(package private)  class MapComponentJFC.MapMouseAdapter
           
(package private)  class MapComponentJFC.MapMouseMotionAdapter
           
(package private)  class MapComponentJFC.PopMenuFleetListener
           
(package private)  class MapComponentJFC.PopMenuSystemListener
           
 
Field Summary
private  MapDisplayOptions displayOptions
           
private  ScreenObjectHandler fleetHandler
           
private  java.util.Vector fleetLocations
           
private  GUIMapJFC mainwindow
           
private  DisplayMap mapInfo
           
private  java.awt.Dimension offDimension
           
private  java.awt.Graphics offGraphics
           
private  java.awt.Image offImage
           
(package private) static int prevX
           
(package private) static int prevY
           
private static java.awt.Color RGB_000_000_100
           
private static java.awt.Color RGB_000_050_000
           
private static java.awt.Color RGB_000_100_000
           
private static java.awt.Color RGB_025_025_000
           
private static java.awt.Color RGB_050_000_050
           
private static java.awt.Color RGB_100_000_000
           
private static java.awt.Color RGB_100_100_000
           
private  java.util.Vector screenObjectsList
           
private  VectorSystemScreenCoord starLocations
           
private  ScreenObjectHandler systemHandler
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
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
(package private) MapComponentJFC(GUIMapJFC in, DisplayMap dmap, MapDisplayOptions in_options, CivID player)
           
 
Method Summary
(package private)  void clearFleetLocations()
           
(package private)  void clearStarLocations()
           
 Index getContext()
           
 MapDisplayOptions getMapDisplayOptions()
           
(package private)  FleetID[] getNearestFleet(int x, int y, int maxd)
           
(package private)  SystemID getNearestSystem(int x, int y, int maxd)
          Gets the nearest system to ScreenCoord x,y.
(package private)  void paintComponent()
          Deprecated. Use repaint() instead
 void paintComponent(java.awt.Graphics g)
           
private  void paintMap(java.awt.Graphics g)
           
(package private)  void putFleetLocation(FleetID FID, int x, int y)
           
(package private)  void putStarLocation(SystemScreenCoord SSC)
           
 void setFleetHandler(ScreenObjectHandler FH)
           
 void setSource(Coord center)
           
 void setSystemHandler(ScreenObjectHandler SH)
           
 void update(java.awt.Graphics g)
          Updates this component.
 void update(java.util.Observable ob, java.lang.Object o)
          This method triggers a repaint whenever an observed object is changed.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mainwindow

private GUIMapJFC mainwindow

starLocations

private VectorSystemScreenCoord starLocations

fleetLocations

private java.util.Vector fleetLocations

offDimension

private java.awt.Dimension offDimension

offImage

private java.awt.Image offImage

offGraphics

private java.awt.Graphics offGraphics

screenObjectsList

private java.util.Vector screenObjectsList

displayOptions

private MapDisplayOptions displayOptions

mapInfo

private DisplayMap mapInfo

fleetHandler

private ScreenObjectHandler fleetHandler

systemHandler

private ScreenObjectHandler systemHandler

RGB_000_050_000

private static final java.awt.Color RGB_000_050_000

RGB_025_025_000

private static final java.awt.Color RGB_025_025_000

RGB_000_000_100

private static final java.awt.Color RGB_000_000_100

RGB_100_000_000

private static final java.awt.Color RGB_100_000_000

RGB_100_100_000

private static final java.awt.Color RGB_100_100_000

RGB_000_100_000

private static final java.awt.Color RGB_000_100_000

RGB_050_000_050

private static final java.awt.Color RGB_050_000_050

prevX

static int prevX

prevY

static int prevY
Constructor Detail

MapComponentJFC

MapComponentJFC(GUIMapJFC in,
                DisplayMap dmap,
                MapDisplayOptions in_options,
                CivID player)
Method Detail

update

public void update(java.util.Observable ob,
                   java.lang.Object o)
This method triggers a repaint whenever an observed object is changed.

Specified by:
update in interface java.util.Observer

update

public void update(java.awt.Graphics g)
Updates this component.

Overrides:
update in class javax.swing.JComponent

paintComponent

void paintComponent()
Deprecated. Use repaint() instead

See Also:
java.awt.Component.repaint()

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

paintMap

private void paintMap(java.awt.Graphics g)

clearStarLocations

void clearStarLocations()

putStarLocation

void putStarLocation(SystemScreenCoord SSC)

clearFleetLocations

void clearFleetLocations()

putFleetLocation

void putFleetLocation(FleetID FID,
                      int x,
                      int y)

getNearestSystem

SystemID getNearestSystem(int x,
                          int y,
                          int maxd)
Gets the nearest system to ScreenCoord x,y. If there's no system within maxd pixels, return null.

Parameters:
x - the x-coordinate on StarMapComponent
y - the y-coordinate on StarMapComponent
maxd - maximum distance (in pixels) to the system
Returns:
The nearest system, if found within maxd pixels, otherwise null.

getNearestFleet

FleetID[] getNearestFleet(int x,
                          int y,
                          int maxd)

setFleetHandler

public void setFleetHandler(ScreenObjectHandler FH)

setSystemHandler

public void setSystemHandler(ScreenObjectHandler SH)

setSource

public void setSource(Coord center)

getContext

public Index getContext()

getMapDisplayOptions

public MapDisplayOptions getMapDisplayOptions()


Copyright © 2001 Universe Dev Team All Rights Reserved.