How to get Parent Containers X,Y

Hello All,

I am dragging a JLabel on top of a JPanel and while I am dragging, I want to know the X,Y points of the JPanel. Since during the drag the mouse is on the JLabel, so is there a way to get the JPanel’s (which is the Parent container of JLabel) points right below where the mouse grabs the JLabel. Thanks.

SI.


getParent().getX();
getParent().getY();

Thanks for the reply. I am still having problem getting the X,Y points when I drag my mouse along with the JLabel outside the rectangle (height = 40, width = 40) of my JLabel. Any ideas??