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.

I know I can get the screen size with java.awt.Toolkit.getDefaultToolkit().getScreenSize(). But if use this value in panel.preferredSize it does not work properly.

asked 22.04.2010 at 05:10

Matthias%20Lang's gravatar image

Matthias Lang
(suspended)
accept rate: 0%


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.

You can use the ClientContext 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.

link

answered 30.04.2010 at 10:46

MichaelD%C3%A4nzer's gravatar image

MichaelDänzer ♦
(suspended)
accept rate: 86%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×40

Asked: 22.04.2010 at 05:10

Seen: 3,820 times

Last updated: 22.04.2010 at 05:10