com.jeffpalm.eggtris
Class EggtrisFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by com.jeffpalm.eggtris.EggtrisFrame
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class EggtrisFrame
extends javax.swing.JFrame
implements java.lang.Runnable, java.awt.event.KeyListener, java.awt.event.MouseListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  MyShape activeShape
          The activeShape.
protected  Board board
          The playing Board.
static int BOARD_HEIGHT
           
static int BOARD_WIDTH
          The dimensions of the Board, ScoreBoard, etc..
protected  java.awt.Image boardBuffer
          Image buffer for the board.
static int BORDER
           
static int BRICK_SIZE
           
protected  boolean gamePaused
          True if game has been paused.
protected  boolean gameStarted
          True if game has started.
protected  boolean gameStopped
          True if game has been stopped.
static java.lang.String IMAGE_NAME
           
protected  java.awt.Image javaLogo
          Image for the Java logo.
protected  int level
          Current level.
static int LINES_PER_LEVEL
           
static int NEXT_B_B_HEIGHT
           
static int NEXT_B_B_WIDTH
           
protected  Board nextBrickBoard
          The Canvas with the next Brick in it.
protected  java.awt.Image nextBrickBoardBuffer
          Image buffer for the next brick board.
protected  MyShape nextShape
          The next shape.
static int POINTS_PER_LINE
           
static int POINTS_PER_SHAPE
           
static int SCORE_BOARD_HEIGHT
           
static int SCORE_BOARD_WIDTH
           
protected  ScoreBoard scoreBoard
          The scoreBoard.
protected  java.awt.Image scoreBoardBuffer
          Image buffer for the score board.
protected  ShapeGenerator shapeGenerator
          The object that gives out new Shapes.
protected  int speed
          Current speed of the blocks (in ms.).
static double SPEED_DECREMENT
           
protected  java.lang.Thread thread
          Thread to drop the Shapes.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS
 
Constructor Summary
EggtrisFrame()
          Initialization.
 
Method Summary
 MyShape getActiveShape()
           
 MyShape getNextShape()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
          KeyListener methods
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
          MouseListener methods
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics g)
           
 void run()
          Deprecated **************** public void stop() { if (thread != null && thread.isAlive()) { thread.stop(); } thread = null; }
 void setActiveShape(MyShape v)
           
 void setNextShape(MyShape v)
           
 void start()
           
 void update(java.awt.Graphics g)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

BOARD_WIDTH

public static final int BOARD_WIDTH
The dimensions of the Board, ScoreBoard, etc..

See Also:
Constant Field Values

BOARD_HEIGHT

public static final int BOARD_HEIGHT
See Also:
Constant Field Values

SCORE_BOARD_HEIGHT

public static final int SCORE_BOARD_HEIGHT
See Also:
Constant Field Values

SCORE_BOARD_WIDTH

public static final int SCORE_BOARD_WIDTH
See Also:
Constant Field Values

BORDER

public static final int BORDER
See Also:
Constant Field Values

BRICK_SIZE

public static final int BRICK_SIZE
See Also:
Constant Field Values

NEXT_B_B_WIDTH

public static final int NEXT_B_B_WIDTH
See Also:
Constant Field Values

NEXT_B_B_HEIGHT

public static final int NEXT_B_B_HEIGHT
See Also:
Constant Field Values

LINES_PER_LEVEL

public static final int LINES_PER_LEVEL
See Also:
Constant Field Values

SPEED_DECREMENT

public static final double SPEED_DECREMENT
See Also:
Constant Field Values

POINTS_PER_LINE

public static final int POINTS_PER_LINE
See Also:
Constant Field Values

POINTS_PER_SHAPE

public static final int POINTS_PER_SHAPE
See Also:
Constant Field Values

IMAGE_NAME

public static final java.lang.String IMAGE_NAME
See Also:
Constant Field Values

level

protected int level
Current level.


speed

protected int speed
Current speed of the blocks (in ms.).


gameStarted

protected boolean gameStarted
True if game has started.


gamePaused

protected boolean gamePaused
True if game has been paused.


gameStopped

protected boolean gameStopped
True if game has been stopped.


thread

protected java.lang.Thread thread
Thread to drop the Shapes.


board

protected Board board
The playing Board.


scoreBoard

protected ScoreBoard scoreBoard
The scoreBoard.


nextBrickBoard

protected Board nextBrickBoard
The Canvas with the next Brick in it.


activeShape

protected MyShape activeShape
The activeShape.


nextShape

protected MyShape nextShape
The next shape.


shapeGenerator

protected ShapeGenerator shapeGenerator
The object that gives out new Shapes.


boardBuffer

protected java.awt.Image boardBuffer
Image buffer for the board.


scoreBoardBuffer

protected java.awt.Image scoreBoardBuffer
Image buffer for the score board.


nextBrickBoardBuffer

protected java.awt.Image nextBrickBoardBuffer
Image buffer for the next brick board.


javaLogo

protected java.awt.Image javaLogo
Image for the Java logo.

Constructor Detail

EggtrisFrame

public EggtrisFrame()
Initialization.

Method Detail

getActiveShape

public MyShape getActiveShape()

setActiveShape

public void setActiveShape(MyShape v)

getNextShape

public MyShape getNextShape()

setNextShape

public void setNextShape(MyShape v)

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container

update

public void update(java.awt.Graphics g)
Overrides:
update in class javax.swing.JFrame

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
KeyListener methods

Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
MouseListener methods

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

start

public void start()

run

public void run()
Deprecated **************** public void stop() { if (thread != null && thread.isAlive()) { thread.stop(); } thread = null; }

Specified by:
run in interface java.lang.Runnable