Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Latest commit

 

History

History

graphics-bounds

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Graphics Bounds Are No Longer Real

Bounds obtained from the graphics device configuration created from a BufferedImage are no longer real. Starting from Java 9, they always return (0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE), which are very huge bounds!

Rectangle bounds = new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR)
		.createGraphics()
		.getDeviceConfiguration()
		.getBounds();
System.out.println(bounds);

The test shows how Java 8 has the expected behaviour while Java 9 surprises us.

(Last checked: 8u152 and 9.0.1; contributed by Vincent Privat)

The JDK-issue JDK-8072682 and the associated commit show this is intentional. Yet we can seriously question the solution applied to the cache problem described in the bug report.