<Swing Dev> RFR: [9] [JDK-8081491] The case print incomplete.

prasanta sadhukhan prasanta.sadhukhan at oracle.com
Fri Aug 28 11:18:39 UTC 2015



On 8/26/2015 6:24 PM, Alexander Scherbatiy wrote:
> On 8/25/2015 1:51 PM, prasanta sadhukhan wrote:
>>
>>
>> On 8/25/2015 3:53 PM, Alexander Scherbatiy wrote:
>>> On 8/24/2015 2:23 PM, prasanta sadhukhan wrote:
>>>> Hi All,
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8081491
>>>> webrev: http://cr.openjdk.java.net/~psadhukhan/8081491/webrev.00/
>>>>
>>>> This seems to be a hidden JTable bug in which if the user does not 
>>>> call pack() or set a ScrollPane() for JTable and rather use 
>>>> JFrame.setSize() smaller than table size then it was found that 
>>>> some of the rows which cannot be fitted in 1st page cannot get 
>>>> printed on 2nd and subsequent pages resulting in blank cells to be 
>>>> printed after 1st page.
>>>> It was found that BasicTableUI checks for table bounds to fall 
>>>> within the clip and if they do not intersect, it bails out from 
>>>> painting the table cells.
>>>
>>>      What is the reason that the graphics clip does not intersect 
>>> the table bounds during printing in the provided test case?
>> The testcase does table.setSize(600,800) whereas frame setSize is 
>> 400,600 .
>> For 1st page, the clip was 0,0,384,752 and bounds was 0,0,384,562 so 
>> they intersect and there's no problem in printing the rows in 1st page.
>> After the 1st page is printed, the clip is set to 0,752,384,48 since 
>> we have printed the rows that we can fit in 1st page and the next set 
>> of rows are to be printed while bounds remains at 0,0,384,562 because 
>> JComponent getBounds is returning the visible frame bounds which did 
>> not change.
>
>     The !bounds.intersects(clip) check prevents printing of table rows 
> which are not visible on the frame.
>     It seems that the issue is that extra rows which are not shown in 
> the frame are printed on the first page.
>     It means that the printed rows and columns should be calculated 
> for the table bounds and clip intersection.
>     The test can be updated to mention that only visible part of the 
> table should be printed.
>
Have modified the code to print only the rows that are displayed on 
console. Also updated the test to mention the same. Please review the 
updated webrev.

http://cr.openjdk.java.net/~psadhukhan/8081491/webrev.01/

Regards
Prasanta
> Thanks,
>    Alexandr.
>
>>
>>> Please, also mention in the email title JDK version for which the 
>>> fix is provided.
>> Done
>>
>> Regards
>> Prasanta
>>
>>> Thanks,
>>>    Alexandr.
>>>
>>>> I devised a solution whereby it will not bail out till either rows 
>>>> or columns are still left to be printed on subsequent pages . 
>>>> Please review and let me know if it's ok.
>>>>
>>>> Regards
>>>> Prasanta
>>>
>>
>




More information about the swing-dev mailing list