Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Need help in ball breaker game

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
use paint method instead of paintComponent and its working fine.....
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • 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.
 
    Bookmark Topic Watch Topic
  • New Topic