|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectballWorlds.framework.BallManagerWorld
ballWorlds.framework.VisibleWorld
public class VisibleWorld
A World manages the Balls that it contains; a VisibleWorld is a World that just displays the balls, without asking them to act.
A VisibleWorld constructs its visual elements:
A VisibleWorld manages its Balls, including animating them by calling each Ball's act method repeatedly.
| Constructor Summary | |
|---|---|
VisibleWorld(List<World> universe,
Dimension size,
Color color,
JFrame ballWorldFrame)
Sets the World's size, color, and home frame to the given values. |
|
| Method Summary | |
|---|---|
void |
drawBalls(Graphics2D graphics,
Ball selectedBall)
Draws the Balls in this World. |
List<World> |
getAllWorlds()
Returns a List |
World |
getAnotherWorld()
Returns a random other World (or this World if it is the only one). |
Color |
getColor()
Returns the Color of this World. |
Shape |
getShape()
Returns the Shape (which contains position and size) of this World. |
protected WorldView |
getView()
TODO Put here a description of what this method does. |
boolean |
isInsideWorldX(Point2D p)
Returns true if the given point's x-coordinate is inside this World. |
boolean |
isInsideWorldY(Point2D p)
Returns true if the given point's y-coordinate is inside this World. |
Point2D |
middleOfWorld()
Returns a new Point2D that is at the middle of this World. |
Point2D |
randomPointInWorld()
Returns a new Point2D that is a random point in this World. |
| Methods inherited from class ballWorlds.framework.BallManagerWorld |
|---|
addBall, allBallsInWorld, getBallsInWorld, intersectingBall, intersectingBalls, nearestBall, removeBall |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ballWorlds.BallManager |
|---|
addBall, allBallsInWorld, intersectingBall, intersectingBalls, nearestBall, removeBall |
| Constructor Detail |
|---|
public VisibleWorld(List<World> universe,
Dimension size,
Color color,
JFrame ballWorldFrame)
Constructs the visual elements of this World:
Starts a Thread that repeatedly asks each Ball to act.
universe - The Universe of Worldssize - Size of this World (including its ButtonPanel).color - Color of this World.ballWorldFrame - JFrame to which the visual elements of this World are to be
added.| Method Detail |
|---|
public boolean isInsideWorldX(Point2D p)
isInsideWorldX in interface WorldDescriberp - the point whose x-coordinate to check
public boolean isInsideWorldY(Point2D p)
isInsideWorldY in interface WorldDescriberp - the point whose y-coordinate to check
public Point2D middleOfWorld()
middleOfWorld in interface WorldDescriberpublic Point2D randomPointInWorld()
randomPointInWorld in interface WorldDescriber
public void drawBalls(Graphics2D graphics,
Ball selectedBall)
graphics - the object onto which to draw.selectedBall - the ball which has been selected (null if none).public Shape getShape()
getShape in interface Drawablepublic Color getColor()
getColor in interface Drawableprotected final WorldView getView()
public List<World> getAllWorlds()
WorldDescriber
getAllWorlds in interface WorldDescriberpublic World getAnotherWorld()
WorldDescriber
getAnotherWorld in interface WorldDescriber
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||