Thread: image removing
View Single Post
  #1 (permalink)  
Old 01-20-2008, 03:28 PM
Triss Triss is offline
Member
 
Join Date: Jan 2008
Posts: 5
Triss is on a distinguished road
image removing
Hi,
I have a little problem with my code. I created 20 little moving pictures (50x50 pixels) and I want them to disappear after clicking at them. I guess that I have to find the image coordinates, so I invented this:

Code:
public void mouseReleased(MouseEvent m){ int mX = m.getX(); int mY = m.getY(); for(int i = pictures.size() - 1; i >= 0; i--) { if( mX > (pictures.elementAt(i).x) && mX < (pictures.elementAt(i).x + 50) && mY > (pictures.elementAt(i).y) && mY < (pictures.elementAt(i).y + 50)) pictures.remove(i); }

But it doesn't work and I have no idea why. If any of you can help me, I'll be grateful.
Reply With Quote
Sponsored Links