example.manyballs
Class SmallBall
java.lang.Object
example.manyballs.SmallBall
- All Implemented Interfaces:
- java.lang.Runnable
class SmallBall
- extends java.lang.Object
- implements java.lang.Runnable
A SmallBall is a lightweight animated ball that runs in it's own thread.
It moves within a rectangular region, bouncing off the walls.
Field Summary |
(package private) int |
ballSize
|
(package private) ManyCanvas |
canvas
|
(package private) static int |
delay
|
(package private) int |
deltaX
|
(package private) int |
deltaY
|
(package private) javax.microedition.lcdui.Graphics |
g
|
(package private) int |
height
|
(package private) int |
left
|
(package private) static int[][] |
matrix
|
(package private) int |
posX
|
(package private) int |
posY
|
(package private) int |
radius
|
(package private) static java.util.Random |
random
|
boolean |
stop
|
(package private) int |
top
|
(package private) int |
width
|
Constructor Summary |
SmallBall(ManyCanvas c,
int left,
int top,
int width,
int height)
Constructor defines the region in which the ball moves as well
as its starting position. |
Method Summary |
(package private) static void |
faster()
|
(package private) boolean |
inside(int x1,
int y1,
int x2,
int y2)
|
(package private) void |
paint(javax.microedition.lcdui.Graphics g)
Paint the ball. |
void |
run()
|
(package private) static void |
slower()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
random
static java.util.Random random
delay
static int delay
matrix
static int[][] matrix
top
int top
left
int left
width
int width
height
int height
posX
int posX
posY
int posY
radius
int radius
ballSize
int ballSize
deltaX
int deltaX
deltaY
int deltaY
g
javax.microedition.lcdui.Graphics g
canvas
ManyCanvas canvas
stop
public boolean stop
SmallBall
SmallBall(ManyCanvas c,
int left,
int top,
int width,
int height)
- Constructor defines the region in which the ball moves as well
as its starting position.
slower
static void slower()
faster
static void faster()
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
paint
void paint(javax.microedition.lcdui.Graphics g)
- Paint the ball.
inside
boolean inside(int x1,
int y1,
int x2,
int y2)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object