It seems that the .getBounds() method of the GraphicsConfiguration class is not reporting the correct values.
GraphicsDevice[] gdArr = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
int width = 0;
for (GraphicsDevice gd : gdArr)
{
if (gd.getType() == gd.TYPE_RASTER_SCREEN)
System.out.println("Value is: " + gd.getDefaultConfiguration().getBounds().getX());
}
I have two monitors: running 1920 * 1080 and 1280 * 1080.
I get the following values:
for .getX() I get:
Value = 1920
Value = 0
for .getY() I get:
Value = 0
Value = 0
I’m running on a Linux platform with Nvidia’s Twinview. Is this a bug outside of Swing?
This is not a bug. The values are correct.
You are getting the bounds of each screen, and then you are getting the X and Y coordinates of each bound, which is the coordinate of the upper-left corner.
GraphicsConfiguration.getBounds()returns aRectangledefining the screen boundaries.Rectangle.getX()andRectangle.getY()return the coordinates of the upper-left corner of the rectangle.Rectangle.getWidth()andRectangle.getHeight()return the size.You have two monitors. Here are the boundaries of each monitor: