<Swing Dev> RFR JDK-8242410: JEditorPane with test/html type and zero margins is not shown
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Wed May 6 21:57:07 UTC 2020
On 4/22/20 2:35 am, Prasanta Sadhukhan wrote:
> I think since this fix is more about margin, it should be placed in more appropriate class related to borders/margin so I have placed my fix in BasicBorders and not in BasicTextUI.
Does it mean that the next line in the test:
pane.setMargin(new Insets(0, 1, 0, 1)); will be ignored?
As far as I understand this small margin was added to the app for the some reason,
and the problem reported was about wrong size of the text, and not about ignoring
small margin which application set. Note that it is also possible to set small
insets via UIDefaults.
>
> http://cr.openjdk.java.net/~psadhukhan/8242410/webrev.1/
>
> Regards
> Prasanta
> On 16-Apr-20 4:58 PM, Sergey Bylokhov wrote:
>> Hi, Prasanta.
>>
>> Remembering the number of regressions caused by the changes in this method, I suggest to improve it by some additional code only when we investigate the root cause of all previous issues. The general approach of using zeros as non-initialized flags seems broken.
>>
>> On 4/13/20 3:06 am, Prasanta Sadhukhan wrote:
>>> Hi All,
>>>
>>> Please review a fix for an issue where it is seen that when JEditorPane is created with empty text and zero top and bottom insets, the text is not shown after updating it by the method setText(String)
>>>
>>> This is because the the JEditorPane height is not updated and remains 0 if the margin top/botton insets are 0.
>>>
>>> Proposed fix is to check if the margin being set is less than default margin, then update the margin to the default.
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8242410
>>>
>>> webrev: http://cr.openjdk.java.net/~psadhukhan/8242410/webrev.0/
>>>
>>> I also considered changing getPreferredSize() to update the rootView size if height is 0, but it seems it has caused some regression in the past, so abstained from that
>>>
>>> /-else if (d.width == 0 && d.height == 0) {/
>>> /+//else if (d.width == 0 || d.height == 0) {/
>>>
>>> / // Probably haven't been layed out yet, force some sort of//
>>> // // initial sizing.//
>>> // rootView.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE);//
>>> // }/
>>>
>>> Regards
>>> Prasanta
>>
>>
--
Best regards, Sergey.
More information about the swing-dev
mailing list