开发者

Explicitly setting size and making it to resizable of my Dialog?

开发者 https://www.devze.com 2022-12-19 17:07 出处:网络
I have created a My custom Dialog which extends org.eclipse.jface.dialogs.Dialog. But whenever it displa开发者_开发百科ys, it displays with a small size and i cant resize it also. So i wanted to know

I have created a My custom Dialog which extends org.eclipse.jface.dialogs.Dialog. But whenever it displa开发者_开发百科ys, it displays with a small size and i cant resize it also. So i wanted to know how to set its size while creation and how to make it resizable.

Thanks


To make the dialog resizeable, add this to your class:

protected boolean isResizable() {
    return true;
}

Usually, you don't have to give it a size but simply specify a layout. The dialog will then layout itself and select a size which fits all elements. So to make it bigger, find the widget which you want to make bigger and set size constraints on it. If you use the default GridLayout, create a GridData instance and install it on the widget with setLayoutData().

In GridData, use widthHint or heightHint for a different preferred size or even minimumWidth/minimumHeight to make sure it doesn't shrink below a certain size.

For more about layouts, read this article.

0

精彩评论

暂无评论...
验证码 换一张
取 消