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

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

  •  05-10-2022
  •  | 
  •  

문제

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.)

도움이 되었습니까?

해결책

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.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top