<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Set window size of a rich dialog depending from the screen resolution</title><link>https://answers.axonivy.com/questions/351/set-window-size-of-a-rich-dialog-depending-from-the-screen-resolution</link><description>&lt;p&gt;We have the problem that rich dialogs runs in screens with different screen resolutions. Running always in full screen mode is no solution and with modal dialogs even not possible. To avoid the scroll bars that some users have, we would like to set the window size depending from the resolution so that everybody gets the best window size. &lt;/p&gt;
&lt;p&gt;I know I can get the screen size with &lt;code&gt;java.awt.Toolkit.getDefaultToolkit().getScreenSize()&lt;/code&gt;. But if use this value in &lt;code&gt;panel.preferredSize&lt;/code&gt; it does not work properly. &lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/351/set-window-size-of-a-rich-dialog-depending-from-the-screen-resolution" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 30 Apr 2010 10:46:40 -0400</lastBuildDate><item><title>Answer by MichaelDänzer</title><link>https://answers.axonivy.com/questions/351/set-window-size-of-a-rich-dialog-depending-from-the-screen-resolution/352</link><description>&lt;p&gt;The logic of Rich dialogs is executed on the server. It means that when you execute your code, then the screen size of the server is returned and set to the preferred size. For sure the screen size on the client will be different and the result is not good.&lt;/p&gt;
&lt;p&gt;You can use the &lt;code&gt;ClientContext&lt;/code&gt; class to get the screen size of the client, but this class is only available when the first rich dialog is started. Another workaround is that window sizes are stored for every user. So, after the user changes the window size after the first start of the rich dialog, the next time the window will open in that size. Note, that this works only for logged in users.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">MichaelDänzer</dc:creator><pubDate>Fri, 30 Apr 2010 10:46:40 -0400</pubDate><guid>https://answers.axonivy.com/questions/351/set-window-size-of-a-rich-dialog-depending-from-the-screen-resolution/352</guid></item></channel></rss>