File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

making image disappeared

 
rajendra peddinti
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i am desiging a dx-ball game in awt/swing where, bricks will placed in rows, a ball will hit the bricks and what ever brick is touched by the ball should be disappeared.

so i've loaded images for bricks and animated ball. i used "clearRect"(java.awt.Graphics)for disappearing image depending on the ball position.

the problem is it is clearing the lower row perfectly and not going to the next row(obviously it wont go ) because it is clearing the same rectangle which it has already cleared.

so can any one suggest me how to remove an image completely(i think you got my sense in using "completley)?

thank you.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without knowing how you have drawn your bricks, it's difficult to say. If they are components (JPanel, JButton, JLabel, etc) then you can simply remove them from their parent.

However, from your description, I'm assuming you have overridden paintComponent and are drawing them manually that way? Could you give us a bit more info regarding this?
 
rajendra peddinti
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg,

your assumption is right. i've overridden paintComponent().following is my piece of code...
 
Campbell Ritchie
Sheriff
Pie
Posts: 47262
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't include "super.paintComponent(g);"? Does that make any difference?
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic