File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Multithreading: bouncing balls problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Multithreading: bouncing balls problem" Watch "Multithreading: bouncing balls problem" New topic
Author

Multithreading: bouncing balls problem

Joe Fett
Greenhorn

Joined: Jul 16, 2008
Posts: 9
I had to find a program that demos a bouncing ball in JPanel and I did that. The next evolution is taking that program and making it add a new ball with each mouse click. I have attempted a few things but now I am totally lost with this project. I was able to get the code to compile but not run.

Anyone have a helpful idea how I can unfunk this code and get it going the right direction? As always, the help is appreciated!





I think I have one clue left...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
What's with all the UnsupportedOperationExceptions? Does the code run if you remove those? If so, what does it do, and where are you stuck making progress?


Android appsImageJ pluginsJava web charts
Joe Fett
Greenhorn

Joined: Jul 16, 2008
Posts: 9
Originally posted by Ulf Dittmer:
What's with all the UnsupportedOperationExceptions? Does the code run if you remove those? If so, what does it do, and where are you stuck making progress?


As I was going through and resolving the issues, I let NetBeans resolve them so I could get it to compile. The result was all that unsupported nonsense which just added to my misery.

I'm stuck at getting the full JPanel or JFrame to show. As it runs now only the title bar of it displays.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
I don't see code that would add a JPanel (or anything, actually) to the JFrame. That the JFrame is sized to essentially nothing is because of the "pack" call - if a frame is empty, then there's no need for it to take up space.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32654
    
    4
If you create a method and don't write anything in it, NetBeans will write "throw new UnsupportedOperationException();" which is useful for method which you intend to implement later. When you have interfaces and wish to leave some of the methods blank, as you have found the hard way ( ) it doesn't help.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Multithreading: bouncing balls problem
 
Similar Threads
dx = -dx; dy = -dy
Balls are not moving
HSV gradient
Grid Alignment and Null Exception
Bouncing balls