RFR: 8210807: Printing a JTable with a JScrollPane prints table without rows populated [v3]

Prasanta Sadhukhan psadhukhan at openjdk.org
Fri Nov 10 06:41:59 UTC 2023


On Fri, 10 Nov 2023 04:53:15 GMT, Tejesh R <tr at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/JViewport.java line 607:
>> 
>>> 605: 
>>> 606:     private Graphics getBackingStoreGraphics(Graphics g) {
>>> 607:         if (g instanceof SunGraphics2D) {
>> 
>> One thing is the change is not obvious as to why it is being done.
>> I think we can make the fix more telling by utilizing isPrinting check to make it prominent that the code path is for printing
>> Suggestion:
>> 
>>        if (!SwingUtilities2.isPrinting(g)) {
>> 
>> Can you see if it works? And yes, you have to make the method public..
>
> Yes, it works, can't use `SwingUtilities2.isPrinting(g)` but can check for `PrintGraphics` instance which is done in `SwingUtilities2.isPrinting(g)` .. Thank you for the input...

Why cant you use isPrinting?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16552#discussion_r1388977079


More information about the client-libs-dev mailing list