<Swing Dev> [9] RFR: JDK-8170349: The printed content is beyond the borders.

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Tue Dec 6 14:52:29 UTC 2016



On 12/6/2016 8:17 PM, Alexandr Scherbatiy wrote:
> On 12/1/2016 9:16 AM, Prasanta Sadhukhan wrote:
>> On 11/30/2016 2:53 PM, Prasanta Sadhukhan wrote:
>>>
>>> Hi All,
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8170349
>>>
>>> webrev: http://cr.openjdk.java.net/~psadhukhan/8170349/webrev.00/
>>>
>>> Please review a fix for a continuation/regression of JDK-8081491 
>>> <https://bugs.openjdk.java.net/browse/JDK-8081491> in which we made 
>>> sure that we print only the JTable rows/columns that is visible on 
>>> console.
>>>
>>> This bug manifests itself as, despite marking JTable PrintMode to 
>>> FIT_WIDTH, we are printing only those columns that are visible on 
>>> console.
>>>
>>> However, if JTable PrintMode is FIT_WIDTH, then as per spec
>>> https://docs.oracle.com/javase/8/docs/api/javax/swing/JTable.PrintMode.html#FIT_WIDTH
>>> we should print all columns on each page (apparently irrespective of 
>>> what is visible)
>>>
>>> The fix takes care of that by making sure the table bounds is 
>>> adjusted to clipwidth [which is already adjusted to total column 
>>> width here 
>>> <http://hg.openjdk.java.net/jdk9/client/jdk/file/f7148ccb86bb/src/java.desktop/share/classes/javax/swing/TablePrintable.java#l504>]
>>> so that all columns are printed and also rectangle border is drawn 
>>> encompassing all columns.
>>>
>> The reason of adjusting the table bounds was because table.print() 
>> calls BasicTableUI.paint() where we compute visibleBounds
>> http://hg.openjdk.java.net/jdk9/client/jdk/file/a5e270f2c97d/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java#l1817
>> therefore we need to adjust the visibleBounds to entire columns 
>> instead of just the visible columns.
>   Did the test Swing_JTable/Manual/PrintManualTest_FitWidthMultiple 
> pass before the fix for the JDK-8081491?
Yes, it did.

Regards
Prasanta
>   It looks like the table bounds never have been changed in the 
> TablePrintable.
>
>   Thanks,
>   Alexandr.
>>
>> Regards
>> Prasanta
>>> The 8081491 testcases passed with this fix as well.
>>>
>>> Regards
>>> Prasanta
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20161206/326747a2/attachment.html>


More information about the swing-dev mailing list