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

📄 servicer.java

📁 一个基于JAVA技术的销售信息管理系统
💻 JAVA
字号:
import java.awt.Toolkit;

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.Display;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import com.swtdesigner.SWTResourceManager;


public class Servicer extends Shell {

	private Composite ServiceManage;
	private Composite SellManage;
	private Composite PolicyManage;
	private Composite CustomerManage;

	private Shell shell;
	private String ID;
	/**
	 * Create the shell
	 * @param display
	 * @param style
	 */
	public Servicer(Display display, int style,String id,String pwd,String ID) {
		super(display, style);
		createContents();

		this.ID	=	ID;
		this.shell	=	this;
		
		ServiceManage = new ServiceManage(this,style,id,pwd);
		ServiceManage.setBounds(0, 0, 700, 552);
		ServiceManage.setVisible(false);
		SellManage = new SellManage(this,style,id,pwd);
		SellManage.setBounds(0, 0, 700, 552);
		SellManage.setVisible(false);
		PolicyManage = new Policy(this,style,id,pwd,ID);
		PolicyManage.setBounds(0, 0, 700, 552);
		PolicyManage.setVisible(false);
		CustomerManage = new CustomerManage(this,style,id,pwd);
		CustomerManage.setBounds(0, 0, 700, 552);
		CustomerManage.setVisible(false);
		this.setParent(ServiceManage);
		setImage(SWTResourceManager.getImage(Admin.class, "id.gif"));
		ServiceManage.setVisible(true);
	}
	
	public void setCenter(){
		// 得到屏幕的宽度和高度
		int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
		int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
		// 得到Shell窗口的宽度和高度
		int shellHeight = this.getBounds().height;
		int shellWidth = this.getBounds().width;
		// 如果窗口大小超过屏幕大小,让窗口与屏幕等大
		if (shellHeight > screenHeight)
			shellHeight = screenHeight;
		if (shellWidth > screenWidth)
			shellWidth = screenWidth;
		// 让窗口在屏幕中间显示
		this.setLocation(((screenWidth - shellWidth) / 2),
				((screenHeight - shellHeight) / 2));
	}
	
	/**
	 * Create contents of the window
	 */
	protected void createContents() {
		setText("销售信息管理系统——通宵达旦工作室");
		setSize(708, 586);
		setCenter();
		//
		final Button button_3 = new Button(this, SWT.BORDER);
		button_3.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				PolicyManage.setVisible(true);
				ServiceManage.setVisible(false);
				SellManage.setVisible(false);
				CustomerManage.setVisible(false);
			}
		});
		button_3.setText("策略公告");
		button_3.setBounds(120, 490, 85, 26);

		final Button button_4 = new Button(this, SWT.BORDER);
		button_4.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				CustomerManage.setVisible(true);
				ServiceManage.setVisible(false);
				SellManage.setVisible(false);
				PolicyManage.setVisible(false);
			}
		});
		button_4.setText("客户管理");
		button_4.setBounds(228, 490, 85, 26);

		final Button button_5 = new Button(this, SWT.BORDER);
		button_5.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				SellManage.setVisible(true);
				ServiceManage.setVisible(false);
				PolicyManage.setVisible(false);
				CustomerManage.setVisible(false);
			}
		});
		button_5.setText("销售管理");
		button_5.setBounds(336, 490, 85, 26);

		final Button button_7 = new Button(this, SWT.BORDER);
		button_7.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				ServiceManage.setVisible(true);
				SellManage.setVisible(false);
				PolicyManage.setVisible(false);
				CustomerManage.setVisible(false);
			}
		});
		button_7.setText("售后管理");
		button_7.setBounds(443, 490, 85, 26);

		final Button button = new Button(this, SWT.NONE);
		button.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {

				ChangePWD changePWD = new ChangePWD(shell.getShell(),ID);
				changePWD.open();
			}
		});
		button.setText("修改密码");
		button.setBounds(570, 490, 85, 26);
	}

	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}

⌨️ 快捷键说明

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