Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有个问题。在 Java 中,如何获取图形元素的屏幕位置,比如说一个标签?如果我使用 getBounds,我得到的是容器内的相对位置,而不是屏幕的确切位置。如果有人可以在这里帮助我,我将不胜感激……谢谢!
尝试使用Component.getLocationOnScreen().
Component.getLocationOnScreen()