I need to fix the screen location of the Open Source Java Application “Angry IP Scanner” on OSX (https://sourceforge.net/projects/ipscan/) at startup.
If you start the application and move it to the extended space of a secondary monitor (Non mirrored) and do one of two things: 1) Unplug your secondary monitor with the app running or 2) quit the app while it is located on the secondary monitor.
If you unplug the second monitor and then start the app, the app loads and places the screen on the now nonexistent 2nd monitor, even though it is not plugged in.
To get to the screen back to the main screen area you MUST plug in a 2nd monitor and move it back to the main screen. Then you can unplug the second monitor and have no problems.
When the app is starting, I think the app needs to check the current screen size verses the previous screen size and if it has changed, place the screen near the 10,10 location so it will show up on the main, hopefully active screen.
In my searching on Stack Overflow, it appears you can find the current screen information like this:
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int width = gd.getDisplayMode().getWidth();
int height = gd.getDisplayMode().getHeight();
How could I save this to a file and recall/compare the previous to the current data, if it has changed, move the application’s window to the 10,10 location?
I am a beginner writing iOS and Ruby on OSX, but have not done any Java. I love the program, but this bug is killing me and there doesn’t appear to be anyone actively working on the code.
Anyone want to help?
BTW … It is bug 84 at the Angry IP Scanner website.
Maybe someone could explain how I could run the following code snippet from the cli?
int resolution =Toolkit.getDefaultToolkit().getScreenResolution();
System.out.println(resolution);
Thanks,
padapa
Something like:
Which outputs…
On my machine