📄 pizzastore.java
字号:
package GUI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import Staff.*;
public class PizzaStore extends Shell {
Staffmanage sm;
final StackLayout stackLayout=new StackLayout();
final Shell shell = this;
/**
* Create the shell
* @param display
* @param style
*/
public PizzaStore(Display display, int style) {
super(display, style);
createContents();
this.setLayout(stackLayout);
}
/**
* Create contents of the window
*/
protected void createContents() {
setText("Pizza");
setSize(644, 564);
sm = new Staffmanage();
//Setup The compisite
final SaleInStore saleInStore = new SaleInStore(this, SWT.NONE);
final PizzaToBake pizzaToBake = new PizzaToBake(this, SWT.NONE,sm);
final TransportManage transportManage = new TransportManage(this, SWT.NONE);
final WageCompute wageCompute = new WageCompute(this, SWT.NONE);
final StorageUpdate storageupdate = new StorageUpdate(this, SWT.NONE);
final Balance balancecom = new Balance(this,SWT.NONE);
final Menu menu = new Menu(shell, SWT.BAR);
setMenuBar(menu);
final MenuItem menuItem_1 = new MenuItem(menu, SWT.NONE);
menuItem_1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl=saleInStore;
shell.layout();
}
});
menuItem_1.setText("销售");
final MenuItem menuItem_2 = new MenuItem(menu, SWT.NONE);
menuItem_2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl=pizzaToBake;
shell.layout();
}
});
menuItem_2.setText("查看待烤PIZZA");
/**
* 考虑到PIZZA订购送货的时候,如果按需求所说,一个PIZZA确定一个外送员。不大适合。这里,考虑成,一份定单有一个外送员
*/
final MenuItem menuItem = new MenuItem(menu, SWT.NONE);
menuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl=transportManage;
shell.layout();
}
});
menuItem.setText("送货管理");
final MenuItem computeThepay = new MenuItem(menu, SWT.NONE);
computeThepay.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl=wageCompute;
shell.layout();
}
});
computeThepay.setText("计算工资");
final MenuItem storageUpdate = new MenuItem(menu, SWT.NONE);
storageUpdate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl=storageupdate;
shell.layout();
}
});
storageUpdate.setText("库存更新");
final MenuItem balance = new MenuItem(menu, SWT.NONE);
balance.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stackLayout.topControl=balancecom;
shell.layout();
}
});
balance.setText("当日结算");
final MenuItem menuItem_3 = new MenuItem(menu, SWT.NONE);
menuItem_3.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.exit(0);
}
});
menuItem_3.setText("退出系统");
//
}
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -