On Fri, 3 Jun 2022 15:21:02 GMT, Alexey Ivanov <[email protected]> wrote:
> > I think that the rendering to the BufferedImage as suggested by
> > @aivanov-jdk should work as well.
>
> In theory only. I was unable to make the table paint with its header to
> `BufferedImage`. The component isn't laid out until it's added to peered
> top-level. If you know how to make it paint as if in the frame, I'd welcome
> it. At this point, painting to `BufferedImage` doesn't reproduce the NPE.
I haven't been trying hard enough.
Painting *the header* to buffered image throws the NPE.
The test could be as simple as this:
Dimension size = header.getPreferredSize();
header.setSize(size);
// Create the image and graphics
header.paint(g2d);
You have to explicitly set size to the header.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8830