<Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not maintained when image is scaled in JEditorPane

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Tue Jul 10 10:17:31 UTC 2018


Fix looks good to me. For test,

152         System.out.println("Test with none of them set");
153 test(r, editorPanes[2], 200, 200);
  154
  155         System.out.println("Test with both of them set to 200");
156 test(r, editorPanes[3], 200, 200);

should be reversed as you do

115 editorPanes[2] = new JEditorPane("text/html",
  116                     "<img width=\"200\" height=\"200\" src=\"file:///" + ABSOLUTE_FILE_PATH + "\"");
  117
118 editorPanes[3] = new JEditorPane("text/html",
  119                     "<img src=\"file:///" + ABSOLUTE_FILE_PATH + "\"");

Same for 158, 161.

Also, what is the need for
158 System.out.println("Test with only height set to 100"); when you 
already have a test for height only 146 System.out.println("Test with 
only height set to 200"); SImilar for width.

Regards
Prasanta
On 7/10/2018 3:15 PM, Krishna Addepalli wrote:
>
> Hi All,
>
> Please review a fix for the bug JDK-8206238: 
> https://bugs.openjdk.java.net/browse/JDK-8206238
>
> Webrev: http://cr.openjdk.java.net/~kaddepalli/8206238/webrev00/ 
> <http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev00/>
>
> The problem is that, when any one of the attributes for the image 
> (height/width), are specified, it should copy the value to the other 
> attribute. Currently, it only updates the respective attribute, and 
> fills the other attribute with the size of the image.
>
> Fixed this problem in the proposed patch.
>
> Thanks,
>
> Krishna
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180710/ee2e4813/attachment.html>


More information about the swing-dev mailing list