Results 1 to 2 of 2
Thread: Mouse listening across layers
- 02-17-2011, 04:09 PM #1Member
- Join Date
- Feb 2011
- Rep Power
Mouse listening across layers
I am having some troubles implementing mouse listening across layers.
I currently have a panel with 2 subpanels as children laying on top of one another. The first panel has an image while the second has a shape.
This image panel is clipped by a circle, and the shape panel adds a shape of a circle to give the clip a nice border and also has some other shapes drawn around the image in the blank area created by the clip.
I would like to add the functionality of allowing a user to draw a box on the image but if a corner is dragged past the limits of the circle the clipping circle will automatically take care of this. This means to me that I need a listener on the image layer to take care of several different types of mouse clicks, (click press, click release, etc) .
I also want to add a listener to the shape layer that does something else on a mouse click.
So far I can't get these to happen at the same time. If I have a listener on the shape layer which is above the image layer, the image layer doesn't hear, but if I turn off the listener on the shape layer the image layer works fine.
Does anyone have any suggestions?
- 02-17-2011, 04:42 PM #2
I would suggest you throw together an SSCCE that demonstrates the problem. Make it as short as possible- we probably don't need all of the clipping and drawing stuff, just a couple of JPanels with a listener set up in the way you have it. That way we have some code to work from.
- By Jon_Xel in forum AWT / SwingReplies: 10Last Post: 07-13-2010, 06:37 AM
- By martypapa in forum New To JavaReplies: 6Last Post: 02-09-2010, 10:14 AM
- By nipunalk in forum Advanced JavaReplies: 5Last Post: 01-20-2010, 06:10 AM
- By Krooger in forum AWT / SwingReplies: 1Last Post: 11-18-2009, 05:34 AM
- By Mosd in forum New To JavaReplies: 0Last Post: 08-12-2008, 01:21 PM