RFR: JDK-8015739: Background of JInternalFrame is located out of JInternalFrame [v4]

Harshitha Onkar honkar at openjdk.org
Mon Oct 31 16:41:43 UTC 2022


On Wed, 5 Oct 2022 16:28:40 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>>> @aivanov-jdk Regarding saving the screen capture -
>>> 
>>> When JIF bounds are used, a partial image of JInternalFrame (JIF) is saved. Hence I'm using the entire outer JFrame bounds to capture the screenshot.
>> 
>> Could be… It shouldn't. Anyway, I have no problem with capturing the entire `JFrame`.
>> 
>>> 
>>> For the screenCapture I wanted to use **BufferedImage's getScaledInstance()** to create the scaled version (code snippet below), but experiencing issues while saving it. Currently I'm scaling the original image and re-drawing it using graphics object.
>>  
>> This is definitely not what we want. It just up-scales or down-scales the current image stored in `BufferedImage`.
>> 
>> When you run in a HiDPI environment or with `uiScale` set explicitly to a value greater than 1.0, the number of pixels is higher. `Robot.createScreenCapture` up-scales the passed in rectangle, captures all the pixels and then down-scales the captured screenshot to the user's space coordinates.
>> 
>> At the same time, [`createMultiResolutionScreenCapture`](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/awt/Robot.html#createScreenCapture(java.awt.Rectangle)) returns a `MultiResolutionImage` which contains two variants: (1) the base image with the user specified size, down-scaled from the screen; (2) native resolution image with the device size pixels. The second variant will preserve all the pixels seen on the screen.
>
>> @aivanov-jdk The extra pixel seems to be added due to JInternalFrame titlebar and not from the paintBorder() code changes.
> 
> Good then. It's not from the border.

@aivanov-jdk Fix has been updated since last approval. Can you please re-review.

-------------

PR: https://git.openjdk.org/jdk/pull/10274



More information about the client-libs-dev mailing list