<Swing Dev> RFR JDK-8242410: JEditorPane with test/html type and zero margins is not shown
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Thu Apr 16 11:28:34 UTC 2020
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