How to determine in which monitor my Java app is running?

别说谁变了你拦得住时间么 提交于 2019-12-08 07:55:14

问题


I want to develop a Java app to get the screenshot of the monitor I'm running the app from, so 30 minutes ago I asked a question about how to capture the screenshots of each one of the monitor the app is running, but seems the question has been asked and answered here : java print screen two monitors

Yet it only partially answered my question, since it showed me how to capture each monitor's screenshot, now my question becomes : if I have 3 monitors, when I run my Java app in each of them, how does my app determin which monitor is it running from ?

I guess maybe I can figure something out from the following 2 lines :

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();

The problem is, can my app tell me the (x,y) from which monitor ? If so I'll be able to get the screenshot of just that device.

来源:https://stackoverflow.com/questions/58346253/how-to-determine-in-which-monitor-my-java-app-is-running

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!