⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 distributemanagerview.java

📁 java eclipse rcp学习
💻 JAVA
字号:
/**
 * 
 */
package chainShopMS.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;
/**
 * @author Administrator
 *	商品分发操作视图
 */
public class DistributeManagerView extends ViewPart
{
	private Text productID;// 商品编号

	private Text productName;// 商品名称
	
	private Text productNum;// 分发数量

	private Combo subShopName;// 接受商店
	
	private Text inceptOperator;// 接受操作员

	private Text distributeOperator;// 分发操作员
	
	private Text distributeNote;// 备注
	
	
	private Button distribute;// 商品分发

	
	/** 该视图的ID */
	public static final String ID = "chainShopMS.views.DistributeManagerView";

	/**
	 * 生成GridData对象的重复代码太多,写出一个可以减少程序的行数,用起来也方便,而且要注意一个GridData只能呗一个组件实验
	 * 不能两个组件使用一个GridData,否则一个组件不会显示出来
	 */
	private GridData createGridData(int style,int horizontalSpan)
	{
		GridData gridData=new GridData(style);
		gridData.horizontalSpan=horizontalSpan;
		gridData.grabExcessHorizontalSpace=true;
		gridData.horizontalAlignment=SWT.FILL;
		return gridData;
	}
	
	// 必须实现的两个方法
	public void createPartControl(final Composite parent)
	{
		parent.setLayout(new GridLayout(4, false));// 信息面板分成6列

		new Label(parent, SWT.NONE).setText("商品编号:");
		productID = new Text(parent, SWT.BORDER);
		productID.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));

		new Label(parent, SWT.NONE).setText("商品名称:");
		productName = new Text(parent, SWT.BORDER);
		productName.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		
		new Label(parent, SWT.NONE).setText("数   量:");
		productNum = new Text(parent, SWT.BORDER);
		productNum.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		
		new Label(parent, SWT.NONE).setText("接收分店:");
		subShopName = new Combo(parent, SWT.BORDER);
		//从数据库从得到供应商的数据添加
		subShopName.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));

		new Label(parent, SWT.NONE).setText("接收店长:");
		inceptOperator = new Text(parent, SWT.BORDER);
		inceptOperator.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		
		new Label(parent, SWT.NONE).setText("分发店长:");
		distributeOperator = new Text(parent, SWT.BORDER);
		distributeOperator.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		
		
		new Label(parent, SWT.NONE).setText("备   注:");
		distributeNote= new Text(parent, SWT.BORDER);
		distributeNote.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 3));
		
		new Label(parent, SWT.NONE);
		new Label(parent, SWT.NONE);
		new Label(parent, SWT.NONE);
		
		//按钮
		distribute =new Button(parent,SWT.NONE);
		distribute.setText("商品分发");
		
		
	}

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

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -