The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Re: Help Please

Your post wasn't anything useful. If you need to copy the console:
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Re: Help Please

Your code has very few comments describing its logic. It will take a long time to figure out what you are trying to do.
Have you tried debugging it by adding lots of println statements to show the values of variables as they are changing. You should be able to look at the output and see where the program is NOT doing what you want it to do by seeing how the variables are being set and changed.
That is exactly how I will attempt to find the logic problem.

Re: Help Please

yeah i had a look through the logic the for loop breaks the while as each thread needs to be running in the while at all times, the for loop runs through 1 2 3 individualy shutting off the other threads, so all threads need to be running at the same time with no break in there like

while(true)
{

ovl [0] [0]+=dx;
ovl [0] [1]+=dy;

if(ovl [0] [0]-rad<0)// this checks to see if there is a horsontal collision
{
dx=-dx; // this reverses the ball away from the wall
ovl [0] [0]=rad;

Re: Help Please

here is what i got:

start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
start while dx-1
start while dy-1
4th if dy1
4th if ovl20
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1
start while dx-1
start while dy1

Re: Help Please

Pretty boring. When posting long repeating group, use ... in the middle.
You print outs don't show a lot of things about your program.
One thing they do show is that there is only one delta value. That's fine for one ball, but what if you have more than one ball and they are moving in different directions?

When is a new RunnableThread created?
When is that class's run method called?
System.out.println("run for " + Thread.currentThread().getName());

Re: Help Please

this is the print outs i got:
X:\Desktop\Programing Resit#\tests\bb2\test 2\test3>javac *.java

X:\Desktop\Programing Resit#\tests\bb2\test 2\test3>java Bouncing_Ball
run for thread1
run for Thread-3
run for thread2
run for Thread-4
run for thread3
run for Thread-5
X:\Desktop\Programing Resit#\tests\bb2\test 2\test3>

it runs the threads ok but the Thread-3 4 5 is abit strange i dont get why it is adding sleep time

Re: Help Please

If you only started one ball by clicking one time with the mouse, then why is the run method called two times? Do you wonder why you got two lines printed out?
It looks like you are creating and starting two threads.