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

📄 customeradd.java

📁 JAVA编写的单击的PIZZA店销售系统
💻 JAVA
字号:
package GUI;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.jface.dialogs.*;
import OrderInf.*;
import PizzaProduct.Pizza;
public class CustomerAdd extends Dialog {

	private Text text_2;
	private Text text_1;
	private Text text;
	protected Object result;
	protected Pizza[] pizzas;
	CustomerInf ci;
	protected Shell shell;

	/**
	 * Create the dialog
	 * @param parent
	 * @param style
	 */
	public CustomerAdd(Shell parent, int style) {
		super(parent, style);
	}

	/**
	 * Create the dialog
	 * @param parent
	 */
	public CustomerAdd(Shell parent,Pizza[] pizzas) {
		this(parent, SWT.NONE);
		this.pizzas=pizzas;
	}

	/**
	 * Open the dialog
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell.open();
		shell.layout();
		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		return result;
	}

	/**
	 * Create contents of the dialog
	 */
	protected void createContents() {
		shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
		shell.setSize(500, 375);
		shell.setText("请输入您的联系方式");

		final Label label = new Label(shell, SWT.NONE);
		label.setText("请输入您的地址");
		label.setBounds(26, 34, 96, 19);

		text = new Text(shell, SWT.BORDER);
		text.setBounds(26, 59, 315, 25);

		final Label label_1 = new Label(shell, SWT.NONE);
		label_1.setText("请输入您的联系电话");
		label_1.setBounds(26, 121, 136, 12);

		text_1 = new Text(shell, SWT.BORDER);
		text_1.setBounds(26, 139, 219, 25);

		final Label label_2 = new Label(shell, SWT.NONE);
		label_2.setText("请输入收货人姓名");
		label_2.setBounds(26, 211, 96, 12);

		text_2 = new Text(shell, SWT.BORDER);
		text_2.setBounds(26, 229, 115, 25);

		final Button button = new Button(shell, SWT.NONE);
		button.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				if(text_2.getText().equals("")||text.getText().equals("")||text_1.getText().equals("")){
					MessageDialog.openError(shell, "错误","请输入完整的信息");
				}
				else{
					final Shell fornext;
					fornext=shell.getShell();
					ci=new CustomerInf(text_2.getText(),text.getText(),text_1.getText());
					final PizzaOrderResult por = new PizzaOrderResult(fornext,pizzas,false,ci);							
					por.open();
					shell.close();
				}
			}
		});
		button.setText("确定");
		button.setBounds(103, 290, 59, 22);

		final Button button_1 = new Button(shell, SWT.NONE);
		button_1.setText("返回");
		button_1.setBounds(298, 290, 59, 22);
		
		
		//
	}

}

⌨️ 快捷键说明

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