<div dir="ltr">I approved PR <a href="https://github.com/openjdk/jdk/pull/26814">https://github.com/openjdk/jdk/pull/26814</a> because I can confirm that the current order of commands results in a centered upper-left corner of the edit window. (Only Windows?)<div><br><div><div>Moving the `jframe.setLocationRelativeTo(null);` after the `jframe.setSize(800, 600);` (and still before `jframe.setVisible(true);`) solves the problem.</div></div></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Aug 18, 2025 at 6:23 AM David Alayachew <<a href="mailto:davidalayachew@gmail.com">davidalayachew@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:monospace" class="gmail_default">Woah, I found something even deeper.</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">Look at the order of the commands. First, we set location, THEN we set the size.</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">Reverse the 2, and then it works!</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">I am 99.999999% sure that, what is happening is Swing tries to center the window when the size defaults to (0, 0), which would be the center of the screen. And then, when we set the size, it keeps its location, but expands down and right, causing the problem we see.</div><div style="font-family:monospace" class="gmail_default"><br></div><div style="font-family:monospace" class="gmail_default">So, I think a cleaner solution would instead be to change the order of the 2 commands. Is that ok with you? Can you test it locally?</div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 17, 2025 at 11:46 PM Chen Liang <<a href="mailto:chen.l.liang@oracle.com" target="_blank">chen.l.liang@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<div dir="ltr">
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi David, thank you so much for your report!</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
Indeed, I can reproduce this issue on my windows device with a different resolution - the 3 bottom buttons are out of the screen. I have created
<a href="https://bugs.openjdk.org/browse/JDK-8365643" target="_blank">https://bugs.openjdk.org/browse/JDK-8365643</a> to track this issue. (Meanwhile it doesn't happen on Ubuntu)</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
I think the problem lies in this line - <a href="https://github.com/openjdk/jdk/blob/bd65d483df4742bb7ce79b613f10f70a45117f84/src/jdk.editpad/share/classes/jdk/editpad/EditPad.java#L92" target="_blank">
https://github.com/openjdk/jdk/blob/bd65d483df4742bb7ce79b613f10f70a45117f84/src/jdk.editpad/share/classes/jdk/editpad/EditPad.java#L92</a></div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
Since you suggested the solution, can you try replacing that call with setLocationByPlatform and see if this fixes your problem on Windows?</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
If this works for you, feel free to contribute a patch to OpenJDK upstream.</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
Kind regards, Chen Liang</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_358621001953888598m_643434816977966052appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_358621001953888598m_643434816977966052divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> compiler-dev <<a href="mailto:compiler-dev-retn@openjdk.org" target="_blank">compiler-dev-retn@openjdk.org</a>> on behalf of David Alayachew <<a href="mailto:davidalayachew@gmail.com" target="_blank">davidalayachew@gmail.com</a>><br>
<b>Sent:</b> Sunday, August 17, 2025 9:39 PM<br>
<b>To:</b> compiler-dev <<a href="mailto:compiler-dev@openjdk.org" target="_blank">compiler-dev@openjdk.org</a>><br>
<b>Subject:</b> JShell EditPad is cutoff by default</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div style="font-family:monospace">Hello <a id="m_358621001953888598m_643434816977966052x_plusReplyChip-0" href="mailto:compiler-dev@openjdk.org" target="_blank">@compiler-dev</a>,</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">On my Windows 11 laptop, when I open up jshell and type /edit, the edit pad that pops up is ALWAYS cutoff at the bottom right of my screen. Please note, I have a 1920x1080 monitor and a computer set
to that resolution.</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">It's annoying, and a bad user experience. Wouldn't it make more sense to do something similar to Swing's setLocationByPlatform()? Or better yet, just pick a sensible default?</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">This should be incredibly easy to recreate. I have tested this on 4 different computers, and all have the same behaviour.</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">Thank you for your time and attention.</div>
<div style="font-family:monospace">David Alayachew</div>
</div>
</div>
</div>
</div></blockquote></div>
</blockquote></div>