<Swing Dev> [14] RFR 8226513:, JEditorPane is shown with incorrect size

Phil Race philip.race at oracle.com
Wed Aug 7 16:12:18 UTC 2019


I have a minor quibble that "rootViewInitialized" is no longer a very 
appropriate variable name,
since it is not just about initialization.
Can we rename it to "rootViewNeedsLayout" ?


Also because the windows 10 issue has a different cause, potentially 
this test can be adjusted
to allow some tolerance to tell the difference between
"not re-layed out at all", and "I'm a few pixels off in my expectations".
ie the test should be about "did I relayout?", not "is my preferred size 
exactly the actual size?".

Could this be a hi-dpi issue ? Are you running at 96 dpi or something 
else when this fails ?


-phil.


On 8/7/19 2:04 AM, Prasanta Sadhukhan wrote:
>
> I confirm that the test pass on linux and mac with the fix and fail 
> without the fix. Only on windows, it fails.
>
> But I also see that the failure is not because of the fix. The 
> "problem" was there even before the fix, for example with jdk13 (fails 
> with jdk11, jdk12 too )
>
> jdk13-b24/bin/java JEditorPaneLayoutTest
> Exception in thread "main" java.lang.RuntimeException: Wrong size 
> java.awt.Dimension[width=183,height=10] expected 
> java.awt.Dimension[width=177,height=44]
>         at JEditorPaneLayoutTest.main(JEditorPaneLayoutTest.java:84)
>
> which got somewhat improved by JDK-8217731 
> <https://bugs.openjdk.java.net/browse/JDK-8217731>
>
> jdk13-b25/bin/java JEditorPaneLayoutTest
> Exception in thread "main" java.lang.RuntimeException: Wrong size 
> java.awt.Dimension[width=181,height=10] expected 
> java.awt.Dimension[width=180,height=44]
>         at JEditorPaneLayoutTest.main(JEditorPaneLayoutTest.java:84)
>
> So, the 1 pixel difference in width was there even before this fix and 
> also this fix fixes the height of the basic text component and the 
> unit tests of JBS works ok, so to me this fix looks ok to me.
>
> +1 for the fix from me and
>
> I have added the test to problem list only for windows to figure out 
> the 1 pixel difference in width which seems to be because of layouting 
> in windows.
>
> http://cr.openjdk.java.net/~psadhukhan/8226513/webrev.01/
>
> Regards
> Prasanta
> On 22-Jul-19 4:01 PM, Prasanta Sadhukhan wrote:
>> Hi Semyon,
>>
>> Although the JBS testcase is passing with your change, your testcase 
>> is failing even with the fix for me in windows10
>>
>> java.lang.RuntimeException: Wrong size 
>> java.awt.Dimension[width=181,height=44] expected 
>> java.awt.Dimension[width=180,height=44]
>>         at JEditorPaneLayoutTest.main(JEditorPaneLayoutTest.java:84)
>>
>> Regards
>>
>> Prasanta
>>
>> On 17-Jul-19 1:33 AM, semyon.sadetsky at oracle.com wrote:
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8226513
>>>
>>> webrev: http://cr.openjdk.java.net/~ssadetsky/8226513/webrev.00/
>>>
>>> The fix adds resetting the root view initialization flag when the 
>>> text component underling document is changed and also removes the 
>>> check for the zero component size for the root view initialization 
>>> to correct the resulting preferred component size in some scenarios 
>>> when the root view need to be initially layouted.
>>>
>>> --Semyon
>>>
>>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20190807/3f598de2/attachment.html>


More information about the swing-dev mailing list