Q:

Set Size of SWT Composite inside a TabFolder

How can I set the Width and Height of a Composite in a tab folder?
PS: setSize and setBounds doesn't work!

A:

Since you haven't said when, where and how you are setting the composite size, therefore, I am assuming that you are setting the size on an event, and well, setSize works for me.
I am on Win7, eclipse 4.2 and JDK 1.6_b30. See the sample code:
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;

public class Test 
{
    public static void main(String[] args) throws Exception
    {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new GridLayout(1, false));

        TabFolder folder = new TabFolder(shell, SWT.TOP);
        folder.setLayout(new GridLayout());
        folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        TabItem item = new TabItem(folder, SWT.NONE);
        item.setText("Tab 1");

        final Composite composite = new Composite(folder, SWT.BORDER);
        composite.setLayout(new GridLayout());
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        Text text = new Text(composite, SWT.BORDER);
        text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        text.setText("Tab 1");
        Button b = new Button(composite, SWT.PUSH);
        b.setText("Press");
        b.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                composite.setSize(23, 43);
            }
        });

        item.setControl(composite);

        shell.setSize(300, 200);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
    }
}

Before Pressing the Button

After Pressing the Button

Though there is catch! As soon as you resize your application, the composite comes back to its original size !!

Also there could be a problem if you don't use any event for setting size (may be some bug or feature in SWT tab-folder). A very non-intrusive hack (which does not need any user interaction) is to use PaintListener. See the below code:
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;

public class Test 
{
    public static void main(String[] args) throws Exception
    {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new GridLayout(1, false));

        final TabFolder folder = new TabFolder(shell, SWT.TOP);
        folder.setLayout(new GridLayout());
        folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        TabItem item = new TabItem(folder, SWT.NONE);
        item.setText("Tab 1");

        final Composite composite = new Composite(folder, SWT.BORDER);
        composite.setLayout(new GridLayout());
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        Text text = new Text(composite, SWT.BORDER);
        text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        text.setText("Tab 1");

        folder.addPaintListener(new PaintListener() {
            public void paintControl(PaintEvent e) {
                composite.setSize(23, 43);
            }
        });

        item.setControl(composite);

        shell.setSize(300, 200);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
    }
}

The PaintListener solution is not a very elegant solution but it works for my development environment. 

