| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I apologize if this gets posted more than once, but the original post did not appear on the list's site after 15 hours, so I'm posting again._______________________________________________
I have a JFrame containing JComponents that implement their own drawing via Graphics2D.draw(Shape). The JComponents are draggable, and most of their shapes do not fill their bounds. Hence, there are situations where:
- two JComponents, A and B, both have Shapes drawn that are, say triangles,
- A and B overlap with A above B (i.e., A's position index is lower), and
- part of B's triangle shows through the bounds of A.
In this situation, I need B to receive a mouse event when the part of B that is clicked on is visible through the bounds of A - normally, only A would receive a mouseEvent since the click is inside its bounds. It's easy enough to test that A's triangle is not under the mouse click with A.Shape.contains(Point). But I have not found a direct way to pass the mouseEvent to B. The glassPane could be made visible, and then intercept and handle all mouseEvents, but this might complicate drags and DnD events. Or, an AWTEventListener could register with the Toolbox and handle mouseEvents. Both of these solutions seems a bit round-about.
Is there a more straight forward mechanism for passing the mouseEvent on to JComponent B in this scenario?
Thanks,
-David
David Daniel
New Mexico State University
email@hidden
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.
| References: | |
| >Sending MouseEvents to JComponents visible through the bounds of another JComponent (From: David Daniel <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.