Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

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.
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic