<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 12:32:52 UTC 2018


Ok. Thanks for the clarification. Btw, there is another reversal as I 
mentioned earlier

158 System.out.println("Test with only height set to 100");
159 test(r, editorPanes[4], 100, 100);
160
161 System.out.println("Test with only width set to 100");
162 test(r, editorPanes[5], 100, 100); as editorPane[4] tests width 100 
121 editorPanes[4] = new JEditorPane("text/html",
122 "<img width=\"100\" src =\"


Regards
Prasanta
On 7/10/2018 5:54 PM, Krishna Addepalli wrote:
>
> Hi Prasanta,
>
> Thanks for your review. Here is the updated webrev: 
> http://cr.openjdk.java.net/~kaddepalli/8206238/webrev01/ 
> <http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev01/>
>
> So, the actual width and height of the image is 200, but the bug is 
> that when any other value (only height or width) is specified, then 
> the image should be scaled to that size(both width and height).
>
> The test tests the same with different values like 100, 50 and 300 
> apart from the original image size of 200.
>
> Hope this clarifies.
>
> Thanks,
>
> Krishna
>
> *From:*Prasanta Sadhukhan
> *Sent:* Tuesday, July 10, 2018 3:48 PM
> *To:* Krishna Addepalli <krishna.addepalli at oracle.com>; 
> swing-dev at openjdk.java.net
> *Subject:* Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not 
> maintained when image is scaled in JEditorPane
>
> 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:///" <file:///>  + ABSOLUTE_FILE_PATH + "\"");
>   117
>  118             editorPanes[3] = new JEditorPane("text/html",
>   119                     "<img src=\"file:///" <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/9c83fa2e/attachment.html>


More information about the swing-dev mailing list