import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;

public class TabDemo {

	public static Display myDisplay;
	public static boolean internalCall = false;

	public static void main(String[] args) {
		internalCall = true;
		myDisplay = new Display();
		TabDemo td = new TabDemo();
		td.runDemo(myDisplay);
	}

	public void runDemo(Display display) {
		myDisplay = display;
		Shell shell = new Shell(display);
		shell.setSize(300,300);
		shell.setText("Tab Demo");

		TabFolder tabFolder1 = new TabFolder(shell,SWT.NONE);
		tabFolder1.setBounds(10,10,270,250);

		//Set up the button tab
		Composite buttonComp = new Composite(tabFolder1,SWT.NONE);
		Button button1 = new Button(buttonComp,SWT.PUSH);
		button1.setSize(100,100);
		button1.setText("Hello");
		button1.setLocation(0,0);
		Button button2 = new Button(buttonComp,SWT.ARROW);
		button2.setBounds(150,0,50,50);

		TabItem item1 = new TabItem(tabFolder1,SWT.NONE);
		item1.setText("Buttons");
		item1.setControl(buttonComp);

		//Set up the label tab
		Composite labelComp = new Composite(tabFolder1,SWT.NONE);
		Label label1 = new Label(labelComp,SWT.NONE);
		label1.setText("Here are some labels for your viewing pleasure");
		label1.setBounds(0,0,250,20);
		Label label2 = new Label(labelComp,SWT.NONE);
		label2.setText("A label is a fine fingered fiend");
		label2.setBounds(0,40,200,20);

		TabItem item2 = new TabItem(tabFolder1,SWT.NONE);
		item2.setText("Labels");
		item2.setControl(labelComp);

		shell.open();

		while(!shell.isDisposed()){
		if(!display.readAndDispatch())
			display.sleep();
		}
		if (internalCall) display.dispose();

	}
}
