Class PoolTableCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--PoolTableCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, DoubleBufferedComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class PoolTableCanvas
extends java.awt.Canvas
implements DoubleBufferedComponent

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  Ball[] ball
           
protected  java.awt.Color ballColor
           
protected  boolean ballFlag
           
protected  int ballRadius
           
protected  Vector clickedPoint
           
protected  java.awt.Dimension d
           
protected  DoubleBufferHandler dbHandler
           
protected  int dx
           
protected  int dy
           
protected  int edgeThickness
           
protected  Hole[] hole
           
protected  int holeRadius
           
protected  Rectangle interior
           
protected  boolean moving
           
protected  int nballs
           
protected  int nholes
           
protected  Vector oldClick
           
 java.awt.Label output
           
protected  int radius
           
protected  int tableHeight
           
protected  int tableWidth
           
protected  int x
           
protected  int y
           
 
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
PoolTableCanvas()
           
 
Method Summary
 Ball getBall(int i)
           
 boolean getBallFlag()
           
 Vector getClickedPoint()
           
 boolean getMoving()
           
 Vector getOldClick()
           
 void initCanvas()
           
 void paint(java.awt.Graphics g)
          method paint calls update to paint the canvas on applet
 void paintFrame(java.awt.Graphics g)
          method paintFrame actually draws the canvas on applet with various components like pockets(holes) and sets up balls with white cue ball
 void setBallFlag(boolean flag)
           
 void setMoving(boolean flag)
           
 void update(java.awt.Graphics g)
          method update updates the canvas
 void updateBalls()
          updateBalls method updates the latest positions of the balls it uses methods like detectTableCollision,detectBallCollision, setPosition,kill,isLive,getPosition,ductStopTime,fallIntoHole, setVelocity,pushIntoDuct,bounceOffWall,collideWithBall,endOfDuct, decelerate from Ball class.
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface DoubleBufferedComponent
createImage, getSize
 

Field Detail

tableHeight

protected int tableHeight

tableWidth

protected int tableWidth

edgeThickness

protected int edgeThickness

holeRadius

protected int holeRadius

ballRadius

protected int ballRadius

nholes

protected int nholes

nballs

protected int nballs

interior

protected Rectangle interior

hole

protected Hole[] hole

ball

protected Ball[] ball

clickedPoint

protected Vector clickedPoint

oldClick

protected Vector oldClick

moving

protected boolean moving

ballFlag

protected boolean ballFlag

x

protected int x

y

protected int y

dx

protected int dx

dy

protected int dy

radius

protected int radius

ballColor

protected java.awt.Color ballColor

d

protected java.awt.Dimension d

dbHandler

protected DoubleBufferHandler dbHandler

output

public java.awt.Label output
Constructor Detail

PoolTableCanvas

public PoolTableCanvas()
Method Detail

initCanvas

public void initCanvas()

update

public void update(java.awt.Graphics g)
method update updates the canvas
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics g)
method paint calls update to paint the canvas on applet
Overrides:
paint in class java.awt.Canvas

paintFrame

public void paintFrame(java.awt.Graphics g)
method paintFrame actually draws the canvas on applet with various components like pockets(holes) and sets up balls with white cue ball
Specified by:
paintFrame in interface DoubleBufferedComponent

updateBalls

public void updateBalls()
updateBalls method updates the latest positions of the balls it uses methods like detectTableCollision,detectBallCollision, setPosition,kill,isLive,getPosition,ductStopTime,fallIntoHole, setVelocity,pushIntoDuct,bounceOffWall,collideWithBall,endOfDuct, decelerate from Ball class. it uses getTime,setTime from Time class. addVector,multiply from Vector class.

getBall

public Ball getBall(int i)

getClickedPoint

public Vector getClickedPoint()

getOldClick

public Vector getOldClick()

getMoving

public boolean getMoving()

setMoving

public void setMoving(boolean flag)

getBallFlag

public boolean getBallFlag()

setBallFlag

public void setBallFlag(boolean flag)