Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » a SWT control refuses to "grab excess vertical space"
a SWT control refuses to "grab excess vertical space" [message #688182] Fri, 24 June 2011 05:30
Zhao Han is currently offline Zhao HanFriend
Messages: 1
Registered: June 2011
Junior Member
The case is that the TopTaskGroup(left one) can "grab excess vertical space" while resizing window, but the NewTaskGroup(the right one), after adding a TooBar on it(see the createAddBtnOnGroup method), it doesn't grow as you resize the window. Why is that?

(I have a shell instance with 2-column GridLayout)

Before resizing:

after resizing

Code is here:

private void createTaskWidgets() {

private void createTopTaskGroup() {
    Group topTasksGroup = new Group(shell, SWT.SHADOW_NONE);

    topTasksTable = new TaskTable(topTasksGroup, TaskTable.SORT_BY_VOTES, iteration, this);
    topTasksTable.setLayoutData(getTableGridData() );

    topTasksGroup.setLayout(new GridLayout() );
    topTasksGroup.setLayoutData(getTableGridData() );

private void createNewTaskGroup() {
    Group newTasksGroup = new Group(shell, SWT.SHADOW_NONE);

    newTasksTable = new TaskTable(newTasksGroup, TaskTable.SORT_BY_CREATION_TIME, iteration, this);
    topTasksTable.setLayoutData(getTableGridData() );

    ToolBar actionToolBar = createAddBtnOnGroup(newTasksGroup);

    newTasksGroup.setLayout(new GridLayout() );
    newTasksGroup.setLayoutData(getTableGridData() );

    // set actionToolBar's location to newTasksGroup's right-top position
            newTasksGroup.getLocation().x + newTasksGroup.getSize().x
                    - actionToolBar.getSize().x - 5,
            newTasksGroup.getLocation().y - 2);

private GridData getTableGridData() {
    GridData gridData = new GridData(0, SWT.FILL, false, true);
    return gridData;

private ToolBar createAddBtnOnGroup(Group newTasksGroup) {
    ToolBar actionToolBar = new ToolBar(newTasksGroup, SWT.HORIZONTAL | SWT.RIGHT);

    addTaskToolItem = new ToolItem(actionToolBar, SWT.PUSH | SWT.RIGHT);
    addTaskToolItem.setImage(new Image(display, TaskConsts.ICON_PLUS));

    final MainWindow mainWindow = this;
    addTaskToolItem.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            new CreateTask(getShell(), mainWindow);

    GridData gridData = new GridData();
    gridData.exclude = true;


    return actionToolBar;

private void organize() {
    GridLayout gridLayout = new GridLayout(2, false);

Thanks in advance~
Previous Topic:Drag and Drop in Swt TreeViewer?
Next Topic:Layout of Text
Goto Forum:

Current Time: Tue Dec 01 15:45:46 GMT 2020

Powered by FUDForum. Page generated in 0.01786 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top