The reason for this is because Windows requires a minimum window width in order to be able to add min / max / close buttons and a window title.
The default style Shellis
SWT.SHELL_TRIM = SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE
Unfortunately, you can’t even get around this by Shellsimply showing the close button:
Shell shell = new Shell(display, SWT.CLOSE | SWT.RESIZE);
Windows will still apply the minimum width.
, , , . ,
Shell shell = new Shell(display, SWT.RESIZE);
:
public static void main(String[] args)
{
RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
rowLayout.wrap = true;
Display display = new Display();
Shell shell = new Shell(display, SWT.RESIZE);
shell.setLayout(new FillLayout());
shell.setMinimumSize(1, 1);
Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(rowLayout);
Label label;
for (int i = 0; i < 100; ++i)
{
label = new Label(composite, SWT.NONE);
label.setText("A");
}
shell.pack();
shell.open();
shell.setSize(50, 200);
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
}
:
