I am facing a problem, my application requirement to allow user to open as many JFrames (using some option), and move that to any monitor attached and then when application run again those frames should be at that location where they been left.

At start up there are total 3 monitors - and these are bounds of each -
1) Monitor Bounds [0,0,1280,1024]
2) Monitor Bounds [1280,0,2560,1024]
3) Monitor Bounds [2560,0,3840,1024]

I opened 4 windows and saved, at save i am saving location of frame (x,y) to file then loading, I did log what is the location of frames, and I see this -

1) Frame Title Frame 1 Frame State 0 Frame location [-28,6,457,530]
2) Frame Title Frame 2 Frame State 0 Frame location [453,3,760,550]
3) Frame Title Frame 3 Frame State 0 Frame location [1548,168,1041,522]
4) Frame Title Frame 4 Frame State 0 Frame location [1310,573,1000,500]

above bold -28 is surpising, as this does not fit to any monitor, that frame was on first monitor (#1) but location I got was of negative x, I taken care of frame minimized state too but that not an issue and surprising thing is that it does not happens all the time, 2 out of 8 times I do see this issue, on rest same frames same position works well.

Not sure what is the issue.

to get monitor location (to print) I used GraphicsConfiguration as it should
and to save I just call frame.getLocationOnScreen(). there is not much of code to provide here.

Thanks in advance.