support.convexhull
Class HelperHullPoint

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by support.convexhull.HullPoint
                  extended by support.convexhull.HelperHullPoint
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, ConvexHullConstants

public class HelperHullPoint
extends HullPoint
implements ConvexHullConstants

A HelperHullPoint extends the basic HullPoint by adding functionality needed to work correctly in the HullHelper. Mainly it deals with graphical representation and storing additional state information.

A HelperHullPoint has two different attributes, on/off hull, and there is a color change associated with each state. There is a third state, but this state is not encountered unless an error occurs. That indicates that the insertion of this point caused an exception.

These should only be created by the HullHelper.

See Also:
HullHelper, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface support.convexhull.ConvexHullConstants
BLUE_POINT_IMAGE, BOTTOM_COLOR, c, CANVAS_HEIGHT, CANVAS_WIDTH, ERROR_COLOR, FIGHTER_MODEL, FRAME_HEIGHT, FRAME_WIDTH, FRAME_X, FRAME_Y, HULL_CONNECT_COLOR, HULL_POINT_RADIUS, IMAGE_PATH, MODEL_PATH, OFF_HULL, ON_HULL, PURPLE_POINT_IMAGE, RED_POINT_IMAGE, ROBOT_MODEL, TOP_COLOR
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
HelperHullPoint(HullCanvas c)
          Constructs a new hull point.
 
Method Summary
 Rectangle getBounds()
          Gets the bounds of this component.
 boolean isError()
          Identifies if this point was the last point inserted before an exception was thrown.
 boolean isOnHull()
          Gets the state of the on/off hull attributed
protected static void loadImages()
           
 void paint(Graphics graphics)
          Paints this point to the specified graphics object.
 void setError(boolean state)
          Flags that this point caused an error.
 void setOnHull(boolean state)
          Sets the state of the on/off hull attribute.
protected  void updateColor()
          This updates the color of the current point.
 
Methods inherited from class support.convexhull.HullPoint
getX, getY, setX, setY
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
 

Constructor Detail

HelperHullPoint

public HelperHullPoint(HullCanvas c)
Constructs a new hull point. However, it does not place the point on the screen. The HullHelper should call setLocation(int, int) after adding the point to the screen.

Parameters:
c - HullCanvas that contains this point
Method Detail

loadImages

protected static void loadImages()

updateColor

protected void updateColor()
This updates the color of the current point. It is called whenever a function is called that could change the color of the point. It does not redraw the point.


getBounds

public Rectangle getBounds()
Gets the bounds of this component.

Overrides:
getBounds in class Component
Returns:
A Rectangle that contains the bounds of this point.

paint

public void paint(Graphics graphics)
Paints this point to the specified graphics object. Assumes that the point (0,0) refers to the upper left corner of the HullCanvas.

Overrides:
paint in class JComponent
Parameters:
graphics - The Graphics object to use when painting this HullPoint

setOnHull

public void setOnHull(boolean state)
Sets the state of the on/off hull attribute.

Parameters:
state - the new state of the on/off hull attribute

setError

public void setError(boolean state)
Flags that this point caused an error.

Parameters:
state - the new state of the error attribute

isOnHull

public boolean isOnHull()
Gets the state of the on/off hull attributed

Returns:
true if the point is on the hull, false otherwise.

isError

public boolean isError()
Identifies if this point was the last point inserted before an exception was thrown.

Returns:
true if point caused an error, false otherwise.