nl.bluering.ppracing
Class Paperview

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--nl.bluering.ppracing.Paperview
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Paperview
extends java.awt.Canvas

This class provides the visuals for the racing-board It renders the circuit to a Graphics object, and adds the cars and their movement to it.

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
 
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
Paperview(Circuit c, Ppracing p)
          Creates a new Canvas for viewing the board
 
Method Summary
 void cursor(boolean b)
          Sets wether or not the cursor should be drawn
 void drawcar()
          Draws the cars of all players to the graphics object provided to paint(Graphics g)
 void drawcircle(int x, int y, java.awt.Color c)
          Draws a circle on the given location with the given color
 void drawcursor()
          Draws the cursor of the current player onto the Graphics object
 void drawline(int x1, int y1, int x2, int y2, java.awt.Color c)
          Draws a line on the given coordinates with the given color
 void fillcircle(int x, int y, java.awt.Color c)
          Draws a filled circle on the given location with the given color
 void paint(java.awt.Graphics g)
          Paints the circuit and the cars to the given Graphics object
 void rebuffer()
          Buffers the current image, for faster painting.
 void update(java.awt.Graphics g)
          Overrules the default update function, thus reducing flickering
 
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
 

Constructor Detail

Paperview

public Paperview(Circuit c,
                 Ppracing p)
Creates a new Canvas for viewing the board
Parameters:
c - The circuit to be used
p - The parental applet
Method Detail

rebuffer

public void rebuffer()
Buffers the current image, for faster painting.

paint

public void paint(java.awt.Graphics g)
Paints the circuit and the cars to the given Graphics object
Overrides:
paint in class java.awt.Canvas

update

public final void update(java.awt.Graphics g)
Overrules the default update function, thus reducing flickering
Overrides:
update in class java.awt.Component

cursor

public void cursor(boolean b)
Sets wether or not the cursor should be drawn

drawcar

public void drawcar()
Draws the cars of all players to the graphics object provided to paint(Graphics g)

drawcursor

public void drawcursor()
Draws the cursor of the current player onto the Graphics object

drawcircle

public void drawcircle(int x,
                       int y,
                       java.awt.Color c)
Draws a circle on the given location with the given color
Parameters:
x - Horizontal location
y - Vertical location
c - Color of the circle

fillcircle

public void fillcircle(int x,
                       int y,
                       java.awt.Color c)
Draws a filled circle on the given location with the given color
Parameters:
x - Horizontal location
y - Vertical location
c - Color of the circle

drawline

public void drawline(int x1,
                     int y1,
                     int x2,
                     int y2,
                     java.awt.Color c)
Draws a line on the given coordinates with the given color
Parameters:
x1 - Horizontal start location
y1 - Vertical start location
x2 - Horizontal end location
y2 - Vertical end location
c - Color of the line