SWT: how to keep the toolbar compact when resizing the app windows?

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();
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top