• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multithreading: bouncing balls problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!



 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Joe Fett
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic