Pig Latin Problem Set Javadocs

cs101.awt
Class ColorField

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bycs101.awt.ColorField
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
DisplayField

public class ColorField
extends java.awt.Canvas

cs101.awt.ColorField provides a colored rectangle that operates as an awt.component.

The color field is setup to have two different states represented by two different colors. The field can be of any size or color.

Copyright (c) 1998 Massachusetts Institute of Technolgoy

Version:
$Id: ColorField.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $
Author:
Todd C. Parnell, tparnell@ai.mit.edu, Joshua R. Brown, reuben@ai.mit.edu
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.awt.Dimension dim
          size of the field
protected  java.awt.Color falseColor
          color when state == false
protected  boolean state
          determines the color of the field
protected  java.awt.Color trueColor
          color when state == true
 
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
ColorField()
          Constructs a rectangular color field with default values for all attibutes.
ColorField(boolean initState, java.awt.Dimension dim, java.awt.Color trueColor, java.awt.Color falseColor)
          Constructs a rectangular colorfield with the passed attributes.
 
Method Summary
 void changeState(boolean newState)
          Changes the state of the color field to the value passed in.
 java.awt.Dimension getMinimumSize()
          Called by this object's container to determine the minimum space required by this object.
 java.awt.Dimension getPreferredSize()
          Called by this object's container to determine the minimum space required by this object.
 void paint(java.awt.Graphics g)
          Draws the color field on the screen in it's current state
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, 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, getMaximumSize, 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, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, 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, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

state

protected boolean state
determines the color of the field


dim

protected java.awt.Dimension dim
size of the field


trueColor

protected java.awt.Color trueColor
color when state == true


falseColor

protected java.awt.Color falseColor
color when state == false

Constructor Detail

ColorField

public ColorField()
Constructs a rectangular color field with default values for all attibutes.
o Initial state = false
o Dimension = 25 X 25
o Color when state is true = green
o Color when state is false = red


ColorField

public ColorField(boolean initState,
                  java.awt.Dimension dim,
                  java.awt.Color trueColor,
                  java.awt.Color falseColor)
Constructs a rectangular colorfield with the passed attributes.

Parameters:
initState - The initial state of the color field.
dim - The dimensions of the color field.
trueColor - The color of the field when the state is true.
falseColor - The color of the field when the state is false.
Method Detail

changeState

public void changeState(boolean newState)
Changes the state of the color field to the value passed in. Changing the state of the field will cause the field to repainted in the appropriate color. If the state is unchanged nothing happens.

Parameters:
newState - The new state of the color field.

paint

public void paint(java.awt.Graphics g)
Draws the color field on the screen in it's current state

Parameters:
g - The graphics context to paint into.

getMinimumSize

public java.awt.Dimension getMinimumSize()
Called by this object's container to determine the minimum space required by this object.

Returns:
the minimum size of the object

getPreferredSize

public java.awt.Dimension getPreferredSize()
Called by this object's container to determine the minimum space required by this object.

Returns:
the prefered size of the object

Pig Latin Problem Set Javadocs