i have a jFrame on Swing in Java, and i want it to output to second monitor, if this monitor exists.
I tried this (by this page) to get resolutions of displays
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for (int j = 0; j < gs.length; j++)
{
GraphicsConfiguration[] gc = gs[j].getConfigurations();
for (int i = 0; i < gc.length; i++)
{
Rectangle gcBounds = gc[i].getBounds();
int xoffs = gcBounds.x;
int yoffs = gcBounds.y;
}
}
But then i watch in debugger to xoffs and yoffs for my first monitor (1360*768) xoffs = 1360 and yoffs = 0 second monitor (1280*1024) xoffs = 0 and yoffs = 0
What am i doing wrong?