alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/******************************************************************************* 
 * Copyright (c) 2000, 2005 IBM Corporation and others. 
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution, and is available at 
 * http://www.eclipse.org/legal/epl-v10.html 
 * 
 * Contributors: 
 *     IBM Corporation - initial API and implementation 
 *     IBM Corporation - added the following constants
 *******************************************************************************/
package eclipseCon2005.KCH.AuthDemo.views;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;

public class SalesView extends ViewPart {

	private Composite composite;

	public SalesView() {
		super();
	}

	public void createPartControl(Composite parent) {
		composite = new Composite(parent, SWT.NONE);
		composite.setLayout(new GridLayout(2, false));
		{
			Label label = new Label(composite, SWT.NONE);
			label.setText("What:");
			Combo combo = new Combo(composite, SWT.NONE);
			combo.add("api");
			combo.add("child");		
			combo.add("hair gel");
			combo.add("hassle");
			combo.add("tofu");
			combo.add("used tractor");
			combo.select(0);
			GridData gridData = new GridData(GridData.FILL_HORIZONTAL);			
			combo.setLayoutData(gridData);

		}
		{
			Label label = new Label(composite, SWT.NONE);
			label.setText("Quantity:");
			Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
			text.setText("1");
		}
		{
			Label label = new Label(composite, SWT.NONE);
			label.setText("Comment:");
			GridData gridData = new GridData();
			gridData.horizontalSpan = 2;
			label.setLayoutData(gridData);
		}
		{
			Text text = new Text(composite, SWT.MULTI | SWT.BORDER);
			text.setText("[comment]");
			GridData gridData = new GridData(GridData.FILL_BOTH);
			gridData.horizontalSpan = 2;
			text.setLayoutData(gridData);
		}
		{
			Button button = new Button(composite, SWT.PUSH);
			button.setText("Submit");
			GridData gridData = new GridData();
			gridData.horizontalSpan = 2;
			button.setLayoutData(gridData);
		}
	}

	public void setFocus() {
		composite.setFocus();
	}

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.