如何在 JFrame 中查找某个像素的颜色?

How to find color of a certain pixel in a JFrame?

我需要在我的 JFrame 中找到特定像素的颜色。不幸的是,我希望框架可以移动,所以我不能使用 Robot 方法 createScreenCapture。

您使用 JFrame.getLocationOnScreen() 方法获取框架位置。

然后使用 Robot.getPixelColor(...) 方法获取相对于帧位置的像素。