org.opensourcephysics.sip.ch03
Class WorldRectangle

java.lang.Object
  extended by org.opensourcephysics.sip.ch03.WorldRectangle
All Implemented Interfaces:
Drawable

public class WorldRectangle
extends java.lang.Object
implements Drawable

WorldRectangle demonstrates how to draw an object using a drawing panel's world coordinates.


Constructor Summary
WorldRectangle(double left, double top, double width, double height)
          Constructs a WorldRectangle with position and dimensions values given in world coordinates.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws this rectangle using a drawing panel's world coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorldRectangle

public WorldRectangle(double left,
                      double top,
                      double width,
                      double height)
Constructs a WorldRectangle with position and dimensions values given in world coordinates.

Parameters:
left - double
top - double
width - double
height - double
Method Detail

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws this rectangle using a drawing panel's world coordinates. Required to implement the Drawable interface.

Specified by:
draw in interface Drawable
Parameters:
panel - DrawingPanel
g - Graphics