| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Canvas
com.jeffpalm.eggtris.Board
public class Board
This public class is the surface on which an Eggtris game is played. The use it you must do the following:
(1) Construct one (see below)
(2) Set an active Shape
(3) Check for lines and when some are found do what you want
(4) If a Shape cannot move down, tell it to giveItsBricksTo this Board
(5) repeat......
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from class java.awt.Canvas | 
|---|
| java.awt.Canvas.AccessibleAWTCanvas | 
| Nested classes/interfaces inherited from class java.awt.Component | 
|---|
| java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy | 
| 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 | |
|---|---|
| Board(int x,
      int y,
      int width,
      int height,
      int brickSize)Instatiates a new Board from the given parameters. | |
| Method Summary | |
|---|---|
|  int | checkForLines()Checks for any lines across the board, starting at the top, and returns the number of lines found. | 
|  void | clearRow(int row)CHANGE TO PROTECTED | 
|  void | dropRows(int bottomMostRow,
         int numberOfRows)CHANGE TO PROTECTED | 
|  boolean | hasAnEmptySpotIn(int x,
                 int y)This is used by Brick to see if it can move to this spot | 
|  void | paint(java.awt.Graphics g)Paints the Graphics context passed in by first painting the back-drop (at the moment, that is just a colored background. | 
|  void | putBrick(Brick brick,
         int x,
         int y)This is used by Shape (or Brick, I'll come back) to put one of its Bricks on the Board. | 
|  void | setActiveShape(MyShape newActiveShape)VERY IMPORTANT!!!!!!!! | 
| 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, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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 | 
| Constructor Detail | 
|---|
public Board(int x,
             int y,
             int width,
             int height,
             int brickSize)
width - Number of bricks across.height - Number of bricks tall.brickSize - The size of the bricks that are created.  This is
                  needed by both Brick and Shape.x - X position.y - Y position.| Method Detail | 
|---|
public void paint(java.awt.Graphics g)
paint in class java.awt.Canvasg - Graphics context on which to paint.
public boolean hasAnEmptySpotIn(int x,
                                int y)
x - The possible s spot.y - The possible y spot.
public void putBrick(Brick brick,
                     int x,
                     int y)
brick - Brick to put on.x - Array spot x in which to put it.y - Array spot y in which to put it.public void setActiveShape(MyShape newActiveShape)
This MUST be called by the Applet (or whatever the controller is) after a Shape is set. After the Shape giveItsBricks to this, the Applet must call this method so the board can treat the new Shape specially.
newActiveShape - Shape which becomes the new active Shape.#eggtris.Shapepublic void clearRow(int row)
Nullifies the row passed in, if it is within the range of rows.
Called by checkForLines.
row - Row to clear.#eggtris.Board.checkForLines()
public void dropRows(int bottomMostRow,
                     int numberOfRows)
Drops all the rows by numberofRows, starting at bottomMostRow.
bottomMostRow - The furthest row down from which to start the drop.numberOfRows - Number of rows to drop.#eggtris.Board.checkForLines()public int checkForLines()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||