Skip to content

Commit

Permalink
FlatScreenInfo: output warning if screens intersect (issue #177)
Browse files Browse the repository at this point in the history
  • Loading branch information
DevCharly committed Sep 23, 2020
1 parent 80f56de commit d52bf9d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private static void printScreenInfo() {
System.out.println();

System.out.println( "Java version: " + System.getProperty( "java.version" ) );
System.out.println( "Java vendor: " + System.getProperty( "java.vendor" ) );

for( GraphicsDevice gd : screenDevices ) {
GraphicsConfiguration gc = gd.getDefaultConfiguration();
Expand Down Expand Up @@ -101,6 +102,19 @@ private static void printScreenInfo() {
System.out.printf( "Insets: left %d / right %d / top %d / bottom %d%n",
screenInsets.left, screenInsets.right, screenInsets.top, screenInsets.bottom );
System.out.println( "Scale: " + toString( scaleX, scaleY ) );

// report warning if screen bounds intersects with another screen
// https://github.com/JFormDesigner/FlatLaf/issues/177
for( GraphicsDevice gd2 : screenDevices ) {
if( gd2 == gd )
continue;

Rectangle bounds2 = gd2.getDefaultConfiguration().getBounds();
if( bounds2.intersects( bounds ) ) {
System.out.println( "Warning: bounds of this screen intersect with bounds of " + gd2.getIDstring() );
System.out.println( " this can lead to misplaced popups" );
}
}
}
}

Expand Down

0 comments on commit d52bf9d

Please sign in to comment.