【发布时间】:2010-02-03 13:45:51
【问题描述】:
如何获取元素的实际屏幕位置,比如按钮?如果我使用 getBounds 我会得到相对于父容器的位置,而不是屏幕......
【问题讨论】:
如何获取元素的实际屏幕位置,比如按钮?如果我使用 getBounds 我会得到相对于父容器的位置,而不是屏幕......
【问题讨论】:
【讨论】:
你可以试试这个:
// Convert a coordinate relative to a component's bounds to screen coordinates
Point pt = new Point(component.getLocation());
SwingUtilities.convertPointToScreen(pt, component);
【讨论】: