example.audiodemo
Class SmallBall

java.lang.Object
  extended by example.audiodemo.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 its own thread. It moves within a rectangular region, bouncing off the walls.


Field Summary
(package private)  int ballSize
           
(package private)  javax.microedition.lcdui.Canvas canvas
           
(package private)  int clr
           
(package private) static int delay
           
(package private)  int deltaX
           
(package private)  int deltaY
           
 boolean doRepaint
           
(package private)  javax.microedition.lcdui.Graphics g
           
(package private)  int height
           
(package private)  int left
           
(package private) static int[][] matrix
           
(package private)  int note
           
static boolean paused
           
(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(javax.microedition.lcdui.Canvas 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) static int getSpeedPercent()
          Returns the speed in percent of the DEFAULT_DELAY
(package private)  void paint(javax.microedition.lcdui.Graphics g)
          Paint the ball.
 void run()
          Starts the ball running.
 void setColor(int clr)
           
 void setNote(int note)
           
(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
 

Field Detail

random

static java.util.Random random

paused

public static boolean paused

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

javax.microedition.lcdui.Canvas canvas

note

int note

clr

int clr

stop

public boolean stop

doRepaint

public boolean doRepaint
Constructor Detail

SmallBall

SmallBall(javax.microedition.lcdui.Canvas 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 Detail

slower

static void slower()

faster

static void faster()

getSpeedPercent

static int getSpeedPercent()
Returns the speed in percent of the DEFAULT_DELAY


setNote

public void setNote(int note)

run

public void run()
Starts the ball running.

Specified by:
run in interface java.lang.Runnable

paint

void paint(javax.microedition.lcdui.Graphics g)
Paint the ball.


setColor

public void setColor(int clr)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object