Ideal way of creating a JFace dialog considering different screen resolutions and fonts

StackOverflow https://stackoverflow.com/questions/21457258

  •  05-10-2022
  •  | 
  •  

Question

I have used grid layout in my dialog and I have several widgets wherein I'm not setting the height or width. But I'm setting the initial size of the dialog by overriding the getInitialSize() method.

@Override
protected Point getInitialSize()
{
    return new Point(400, 400); 
}

Will this cause the widgets inside the dialog to appear improperly (like partially hidden) ?

If yes , Would this issue be solved by using a ScrolledComposite inside the main composite? (so that even if the widgets are not proper, the scrolling would help viewing the complete widgets.)

Était-ce utile?

La solution

If you are worried that not all of your content will fit on the screen on all resolutions, here are a couple of things to consider:

  1. Wrap your whole content in a ScrolledComposite (as you already mentioned).
  2. Try splitting your content into several parts and either use a wizard type of GUI or tabs, depending on your requirements.
  3. Try avoiding setting a fixed size for the window. Either let it compute its optimal size or at least set the size to a percentage of the screen.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top