Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help sending event to the object in the next layer of a jlayeredpane

Status
Not open for further replies.

joelwenzel

Programmer
Jun 28, 2002
448
Hi,

I've been working on this silly jigsaw puzzle program and am having a problem. My puzzle pieces are contained in a JLayeredPane so that when I pick one up and set it down again, it is ontop of all previous pieces. Anyway, the puzzle pieces are each contained in a panel and part of the pieces are transparent. When I click on the transparent part of a piece, I want to be able to selected the piece beneath. Is there a way to send the event down a layer ?

Also, to determine if a pixel is transparent, I am using a really bad method.

ufferedImage t = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g1 = (Graphics2D)t.getGraphics();
g1.drawImage(pic,0,0,this);//=g;
int pixColour = t.getRGB(oldX, oldY);
if(pixColour==0)
//pixel is transparent

Actually, I'm pretty syre 0 is black so this code won't even work if there is solid black in the picture. I tried using pixelgrabber to get a single pixel but it is overly complicated and I couldn't figure it out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top