<Swing Dev> RFR JDK-8242410: JEditorPane with test/html type and zero margins is not shown

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Mon Apr 13 10:06:07 UTC 2020


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20200413/7a0cd45b/attachment.htm>


More information about the swing-dev mailing list