FileDocCategorySizeDatePackage
Ch07_03.javaAPI DocExample1182Tue Nov 18 14:31:10 GMT 2003org.eclipsebook.ch07

Ch07_03.java

/*
 * Created on Nov 17, 2003
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package org.eclipsebook.ch07;

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

/**
 * @author Steven Holzner
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class Ch07_03 {

	public static void main (String [] args) {
		Display display = new Display ();
		final Shell shell = new Shell (display);
		shell.setSize(300, 200);
		shell.setLayout(new RowLayout());
		
		final Composite composite = new Composite(shell, SWT.NONE);
		GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 4;
		composite.setLayout(gridLayout);
		
		for (int loopIndex = 0; loopIndex < 18; loopIndex++) {
			Button button = new Button(composite, SWT.PUSH);
			button.setText("Button " + loopIndex);
		}

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