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.
精彩评论