my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes making image disappeared Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "making image disappeared" Watch "making image disappeared" New topic
Author

making image disappeared

rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
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

Joined: Jul 11, 2001
Posts: 15299
    
    6

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?


GenRocket - Experts at Building Test Data
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
Gregg,

your assumption is right. i've overridden paintComponent().following is my piece of code...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38513
    
  23
You didn't include "super.paintComponent(g);"? Does that make any difference?
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: making image disappeared