This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 23rd, 2011  |  syntax: Java  |  size: 1.07 KB  |  views: 46  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**
  2.  * This class represents a physical body that can have colour.
  3.  */
  4.  
  5. package robot.objects;
  6.  
  7. import net.phys2d.raw.Body;
  8. import net.phys2d.raw.shapes.DynamicShape;
  9. import net.phys2d.raw.shapes.Shape;
  10.  
  11. public class ColouredBody extends Body {
  12.  
  13.  
  14.     /**
  15.      * Holds the colour of the coloured body.
  16.      */
  17.     private Colour colour;
  18.  
  19.     /**
  20.      * Creates a new coloured body with the specified colour.
  21.      *
  22.      * @param name The name to assign to the body
  23.      * @param shape The shape describing this body
  24.      * @param m The mass of the body
  25.      */
  26.    
  27.     public ColouredBody(String name,DynamicShape shape, float m, Colour colour){
  28.         super(name,(Shape) shape,m);
  29.         this.setColour(colour);
  30.     }
  31.  
  32.     /**
  33.      * Sets the colour of the body.
  34.      * @param colour
  35.      */
  36.  
  37.     public final void setColour(Colour colour) {
  38.         this.colour = colour;
  39.     }
  40.  
  41.     /**
  42.      * Returns the colour of the body.
  43.      * @return The colour of the body.
  44.      */
  45.  
  46.     public Colour getColour(){
  47.         return this.colour;
  48.     }
  49. }
clone this paste RAW Paste Data