• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

noob needs paint help

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

this is some code taken from the net, modified a bit, that I'm trying to understand. The idea is to bounce a ball. Currently the ball bounces in a continuous line, but I can't see where I'm messing up.

thanks for your time
 
Marshal
Posts: 79710
381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some very old-fashioned looking code there, with _x and _y. That is an acceptable format in C, but not considered correct style in Java.
And some odd features like an empty catch and a SUID of 1L. Also using thread priorities (which is probably unnecessary) may lose portability.

Try super.paint(g); as the first line of the paint() method.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic