On Tue, 21 Jul 2026 20:04:59 GMT, Phil Race <[email protected]> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Move paintString block to paint
>
> I haven't tested it (I'll leave you to write the updated test first) but I 
> think this is simpler and cleaner
> 
> 
> -        Graphics2D g2 = (Graphics2D) g;
> +        Graphics2D g2;
> +        BufferedImage image = null;
> +        if (g instanceof Graphics2D) {
> +            g2 = (Graphics2D)g;
> +        } else {
> +            image = new BufferedImage(width, height, 
> BufferedImage.TYPE_INT_RGB);
> +            g2 = image.createGraphics();
> +        }
>          final AffineTransform savedAT = g2.getTransform();
>          if (!progressBar.getComponentOrientation().isLeftToRight()) {
>              //Scale operation: Flips component about pivot
> @@ -200,9 +208,13 @@ protected void paint(final Graphics g) {
>              g2.scale(-1, 1);
>              g2.translate(-progressBar.getWidth(), 0);
>          }
> -        painter.paint(g, progressBar, i.left, i.top, width, height);
> +        painter.paint(g2, progressBar, i.left, i.top, width, height);
>  
>          g2.setTransform(savedAT);
> +        if (image != null) {
> +            g.drawImage(image, 0, 0, width, height, null);
> +            g2.dispose();
> +        }

@prrace Can you please review the latest change for vertical progressbar?

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

PR Comment: https://git.openjdk.org/jdk/pull/31749#issuecomment-5199798027

Reply via email to