|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCSE115.FishBowl.MovingBodyAdapter
public abstract class MovingBodyAdapter
Normal users can ignore this class. A class that implements many of the methods of MovingBody by delegating the work to Shape objects. This class is only made available for those wishing to create new type of MovingBody classes. Created: Sat Jan 31 14:56:17 2004
Field Summary |
---|
Fields inherited from interface NGP.Colorable |
---|
DEFAULT_GRAY |
Constructor Summary | |
---|---|
MovingBodyAdapter(Shape delegate)
Creates a new MovingBodyAdapter instance. |
|
MovingBodyAdapter(Shape delegate,
int x_low,
int x_high,
int y_low,
int y_high)
|
Method Summary | |
---|---|
boolean |
contains(Point param1)
Delegated to the shape. |
Rectangle |
getBounds()
Delegated to the shape. |
Point |
getCenterLocation()
Delegated to the shape. |
Color |
getColor()
Delegated to the shape. |
Dimension |
getDimension()
Delegated to the shape. |
DrawingPanel |
getDrawingPanel()
Delegated to the shape. |
int |
getDx()
Get the change in x. |
int |
getDy()
Get the change in y. |
Point |
getLocation()
Delegated to the shape. |
int |
getRotation()
Delegated to the shape. |
void |
hide()
Delegated to the shape. |
boolean |
intersects(Graphic param1)
Delegated to the shape. |
void |
mouseClicked(MouseEvent param1)
Delegated to the shape. |
void |
mouseDragged(MouseEvent param1)
Delegated to the shape. |
void |
mouseEntered(MouseEvent param1)
Delegated to the shape. |
void |
mouseExited(MouseEvent param1)
Delegated to the shape. |
void |
mouseMoved(MouseEvent param1)
Delegated to the shape. |
void |
mousePressed(MouseEvent param1)
Delegated to the shape. |
void |
mouseReleased(MouseEvent param1)
Delegated to the shape. |
void |
paint(Graphics2D param1)
Delegated to the shape. |
void |
react()
Called when a Reactor decides that it was
clicked on. |
void |
setBackgroundColor(Color color)
Set the color of the background. |
void |
setColor(Color param1)
Delegated to the shape. |
void |
setDimension(Dimension param1)
Delegated to the shape. |
void |
setDrawingPanel(DrawingPanel param1)
Delegated to the shape. |
void |
setFrameDelay(int milliseconds)
Sets the delay in milliseconds between calls to move(). |
void |
setLocation(Point param1)
Delegated to the shape. |
void |
setRotation(int param1)
Delegated to the shape. |
void |
setVelocity(int dx,
int dy)
Sets the velocity, in the x and y directions of the ball. |
void |
show()
Delegated to the shape. |
void |
startBouncing()
Start (global) bouncing behavior. |
void |
stopBouncing()
Stop (global) bouncing behavior. |
void |
update()
Update the position of the ball based on the velocity, if the ball hits a wall, reverses velocity in the appropriate direction. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MovingBodyAdapter(Shape delegate)
MovingBodyAdapter
instance.
delegate
- the shape that does the work.public MovingBodyAdapter(Shape delegate, int x_low, int x_high, int y_low, int y_high)
Method Detail |
---|
public void update()
update
in interface MovingBody
public void setVelocity(int dx, int dy)
setVelocity
in interface MovingBody
dx
- the new change in x value.dy
- the new change in y value.public int getDx()
getDx
in interface MovingBody
public int getDy()
getDy
in interface MovingBody
public void setFrameDelay(int milliseconds)
milliseconds
- the delay in milliseconds.public void startBouncing()
public void stopBouncing()
public void setBackgroundColor(Color color)
color
- the new background color.public boolean contains(Point param1)
contains
in interface Graphic
param1
- the Point to check for containment
true
if the Point is contained,
false
otherwiseGraphic.contains(Point)
public boolean intersects(Graphic param1)
intersects
in interface Graphic
true
if it does intersect, false
if notGraphic.intersects(Graphic)
public void paint(Graphics2D param1)
paint
in interface Graphic
param1
- the Graphics2D
to use when paintingGraphic.paint(Graphics2D)
public void hide()
hide
in interface Graphic
Graphic.hide()
public void show()
show
in interface Graphic
Graphic.show()
public void setDrawingPanel(DrawingPanel param1)
setDrawingPanel
in interface Graphic
param1
- the DrawingPanel
to useGraphic.setDrawingPanel(DrawingPanel)
public DrawingPanel getDrawingPanel()
getDrawingPanel
in interface Graphic
Graphic
's DrawingPanel
Graphic.getDrawingPanel()
public Rectangle getBounds()
getBounds
in interface Graphic
Graphic.getBounds()
public Point getCenterLocation()
getCenterLocation
in interface Graphic
Graphic.getCenterLocation()
public void setColor(Color param1)
setColor
in interface Colorable
param1
- the color to set the Colorable
Colorable.setColor(Color)
public Color getColor()
getColor
in interface Colorable
Colorable
Colorable.getColor()
public void mouseDragged(MouseEvent param1)
mouseDragged
in interface MouseMotionListener
MouseMotionListener.mouseDragged(MouseEvent)
public void mouseMoved(MouseEvent param1)
mouseMoved
in interface MouseMotionListener
MouseMotionListener.mouseMoved(MouseEvent)
public void mouseClicked(MouseEvent param1)
mouseClicked
in interface MouseListener
MouseListener.mouseClicked(MouseEvent)
public void mouseEntered(MouseEvent param1)
mouseEntered
in interface MouseListener
MouseListener.mouseEntered(MouseEvent)
public void mouseExited(MouseEvent param1)
mouseExited
in interface MouseListener
MouseListener.mouseExited(MouseEvent)
public void mousePressed(MouseEvent param1)
mousePressed
in interface MouseListener
MouseListener.mousePressed(MouseEvent)
public void mouseReleased(MouseEvent param1)
mouseReleased
in interface MouseListener
MouseListener.mouseReleased(MouseEvent)
public void setDimension(Dimension param1)
setDimension
in interface Sizeable
param1
- the user-preferred Dimension
of this
Sizeable
Sizeable.setDimension(Dimension)
public Dimension getDimension()
getDimension
in interface Sizeable
Dimension
of this Sizeable
Sizeable.getDimension()
public Point getLocation()
getLocation
in interface Locatable
Point
for this Locatable
Locatable.getLocation()
public void setLocation(Point param1)
setLocation
in interface Locatable
param1
- the new Point
for this Locatable
Locatable.setLocation(Point)
public void setRotation(int param1)
setRotation
in interface Rotatable
param1
- the number of degrees this Rotatable
should
rotateRotatable.setRotation(int)
public int getRotation()
getRotation
in interface Rotatable
Rotatable
is rotatedRotatable.getRotation()
public void react()
NGP.Reactor
Reactor
decides that it was
clicked on.
react
in interface Reactor
Reactor.react()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |