• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Need help in ball breaker game

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello every body i have some painting problem with the game can anybody help.....
here is the code
Untitled.jpg
[Thumbnail for Untitled.jpg]
problem
 
rahul taiwala
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use paint method instead of paintComponent and its working fine.....
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rahul taiwala wrote:use paint method instead of paintComponent and its working fine.....



This solution sounds very wrong. Sorry but it sounds like you're fixing the wrong thing, but I can't say what since I can't get your code to compile or run due to missing classes. One problem I see that is not causing your main question but can bite you later is that you have program logic within your paint/paintComponent method as indicated by my comment // **** here ****:



and program logic should not be in this method as you do not have full control as to when or if it will be called. Also it is strange to see a repaint() call within a paint/paintComponent method. If the JVM weren't smart, this would cause an infinite recursive cycle.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic