H
Hardy
Hi gurus,
I'm new to SWT and I have a problem which I don't know how to
resolve.
what I needs:
an app window with a toolbar, and a text control under the toolbar.
when the app window resizes, the toolbar keep its size (height, the
width enlarged to fill the new space if applicable) and the text
resize to fill all the windows. I tried filllayout, gridlayout,
rowlayout but just no luck. I believe there must be something I don't
know..
pls help... with a simple example... thank you very much!
public static void main(String[] args) {
Display display = Display.getDefault();
Shell shell = new Shell();
shell.setText("SWT Application");
shell.setLayout(new FillLayout(SWT.VERTICAL));
ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT |
SWT.VERTICAL);
ToolItem tltmFile = new ToolItem(toolBar, SWT.NONE);
tltmFile.setText("File");
text = new Text(shell, SWT.BORDER);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
I'm new to SWT and I have a problem which I don't know how to
resolve.
what I needs:
an app window with a toolbar, and a text control under the toolbar.
when the app window resizes, the toolbar keep its size (height, the
width enlarged to fill the new space if applicable) and the text
resize to fill all the windows. I tried filllayout, gridlayout,
rowlayout but just no luck. I believe there must be something I don't
know..
pls help... with a simple example... thank you very much!
public static void main(String[] args) {
Display display = Display.getDefault();
Shell shell = new Shell();
shell.setText("SWT Application");
shell.setLayout(new FillLayout(SWT.VERTICAL));
ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT |
SWT.VERTICAL);
ToolItem tltmFile = new ToolItem(toolBar, SWT.NONE);
tltmFile.setText("File");
text = new Text(shell, SWT.BORDER);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}