在窗口中找到JFrame的位置/位置 [英] Find the location/Position of JFrame in the window

查看:312
本文介绍了在窗口中找到JFrame的位置/位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到JFrame的起始位置/位置,以便将鼠标光标从JFrame窗口映射到桌面。有没有找到JFrame的X,Y位置?

I am trying to find the Starting location/position of the JFrame in order to map the mouse cursor from the JFrame window to desktop. Is there anyway to find the X,Y position of JFrame ?

推荐答案

你可以使用 getLocation() getLocationOnScreen() JFrame 的c $ c> 方法来自java.awt.Component。

You can use getLocation() or getLocationOnScreen() method of JFrame which are inherited from java.awt.Component.

这篇关于在窗口中找到JFrame的位置/位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆