问题
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