Posted by jdt05
on May 31, 2009 at 12:12 PM PDT
I have a problem that I'm not quite sure how to solve.
Imagine you have a panel wrapped in a JXLayer with MyUI with a textfield in it wrapped in another JXLayer with another instance of MyUI.
I want to be able to detect which component is clicked. If the panel is clicked then I want to detect that and if the textfield is clicked then I also want to detect that. The problem I have is if I click the textfield I get a mouse event from the textfield AND the panel even if I do event.consume() after processing from the textfield event.
I've also tried doing SwingUtilities.getDeepestComponentAt(l.getView(), x, y) as a check so when the event for the panel instance gets fired I can check if the deepest component is the panel, but that method always seems to return the panel even though I know I clicked the textfield!
I'm sure there's something small I'm missing.
Any help would be greatly appreciated!