why JButton.getLocation() return Point of the JButton respect to Frame,
but myPanel.getLocation() return Point of the panel respect to father-panel ??????
How do it?
It is hard to believe your worlds because JButton as well as JPanel share same implementation of the location inherited from JComponent. I am working in this area and never experienced this behaviour.
"getLocation()" always works relative to the parent component "getParent()" with the only exception to this being heavy weight window containers - JDialog, JFrame... that always do use screen coordinates.
Please check that you are not mixing Swing components ... JButton, JPanel, JFrame with their AWT counterparts Button, Panel, Frame...
If you still have problem please provide JUnit TestCase, as I still cant believe your words.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.