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

Discussion in 'Java' started by Hardy, Aug 2, 2011.

  1. Hardy

    Hardy Guest

    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();
    }
    }
    }
    Hardy, Aug 2, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Passwater via DotNetMonster.com

    C# compact framework: IO problem: app running on PDA can't find file.

    Daniel Passwater via DotNetMonster.com, Dec 30, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    747
    Craig Deelsnyder
    Jan 1, 2005
  2. Ramon F Herrera

    Where can I download SWT? (SWT homepage)

    Ramon F Herrera, Dec 5, 2007, in forum: Java
    Replies:
    11
    Views:
    4,033
    Ramon F Herrera
    Dec 6, 2007
  3. pcouas
    Replies:
    0
    Views:
    258
    pcouas
    Feb 19, 2007
  4. Pil (Trustworthy from Experience)

    Resizing a div by resizing its borders

    Pil (Trustworthy from Experience), Apr 18, 2009, in forum: Javascript
    Replies:
    9
    Views:
    348
    Proper
    Apr 21, 2009
  5. Proper
    Replies:
    0
    Views:
    198
    Proper
    Apr 18, 2009
Loading...

Share This Page