how do I get the开发者_如何学Python actual screen position of an element, say a Button? If I use getBounds I get the position relative to the parent container, not the screen...
Have you tried Component.getLocationOnScreen()
?
You can try this:
// Convert a coordinate relative to a component's bounds to screen coordinates
Point pt = new Point(component.getLocation());
SwingUtilities.convertPointToScreen(pt, component);
精彩评论