RFR: 6429812: NPE after calling JTable.updateUI() when using a header renderer + XP L&F [v5]
Alexey Ivanov
aivanov at openjdk.java.net
Fri Jun 3 15:42:33 UTC 2022
On Fri, 3 Jun 2022 15:21:02 GMT, Alexey Ivanov <aivanov at openjdk.org> 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
More information about the client-libs-dev
mailing list