Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] [GridData] Buttons Placement Problem

Hello,

i'm using SWT from eclipse API and i'm trying to do some easy GUI but
without success. A pic of what I do can be seen here :

http://yolepro.multimania.com/SWT.gif

and my code is the following :

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.layout.*;

public class TestSWT {

public static void main (String [] args) {
 Display display = new Display ();
 Shell shell = new Shell (display);

 GridLayout gridLayout = new GridLayout();
         gridLayout.numColumns = 3;
 shell.setLayout(gridLayout);

 Button butt1 = new Button(shell, SWT.PUSH);
 Button butt2 = new Button(shell, SWT.PUSH);
 Button butt3 = new Button(shell, SWT.PUSH);
 Button butt4 = new Button(shell, SWT.PUSH);

 GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
       gridData.widthHint = 40;
       gridData.grabExcessHorizontalSpace = false;
 butt1.setLayoutData(gridData);

 gridData = new GridData(GridData.FILL_HORIZONTAL);
       gridData.horizontalSpan = 2;
 butt2.setLayoutData(gridData);

 gridData = new GridData(GridData.FILL_HORIZONTAL);
       gridData.verticalAlignment = gridData.FILL_VERTICAL;
       gridData.horizontalSpan = 2;
 butt3.setLayoutData(gridData);

 gridData = new GridData(GridData.FILL_VERTICAL);
       gridData.widthHint = 40;
       gridData.grabExcessHorizontalSpace = true;
 butt4.setLayoutData(gridData);

 shell.pack ();
 shell.open ();
 while (!shell.isDisposed ()) {
  if (!display.readAndDispatch ()) display.sleep ();
 }
 display.dispose ();
}
}

The problem is the following :
I want both arrowed button (shown in the picture) with fixed size and button next to its that
take the rest of the window (when you resize it horizontaly).

Thanks in advance for your help.
Any help, even a good place to find prescious help ;)


_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous ! http://search.msn.fr/worldwide.asp



Back to the top