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

📄 operatorsettingjdialog.java

📁 一个KTV管理系统
💻 JAVA
字号:
package view.SystemSetting;

import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JComboBox;
import javax.swing.JButton;
import vo.Operator;
import vo.WaiterInfo;
import common.centerwindow.CenterWindow;
import common.checkinputvalue.Check;

import dao.operator.OperatorSettingDao;


public class OperatorSettingJDialog {

	private JDialog jDialog = null;  //  @jve:decl-index=0:visual-constraint="45,34"
	private JPanel jContentPane = null;
	private JLabel OperatorNamejLabel = null;
	private JTextField OperatorNamejTextField = null;
	private JLabel OperatorPwdjLabel = null;
	private JPasswordField OperatorPwdjPasswordField = null;
	private JLabel BasicInfojLabel = null;
	private JLabel AdvancedInfojLabel = null;
	private JLabel OperatorLeveljLabel = null;
	private JComboBox OperatorLeveljComboBox = null;
	private JButton ConfirmjButton = null;
	private JButton CanceljButton = null;
	private JLabel OperatorIdjLabel = null;
	private JTextField OperatorIdjTextField = null;

	/**
	 * This method initializes jDialog	
	 * 	
	 * @return javax.swing.JDialog	
	 */
	public JDialog getJDialog() {
		if (jDialog == null) {
			jDialog = new JDialog();
			new CenterWindow().centerWindow(jDialog);
			jDialog.setSize(new java.awt.Dimension(295,336));
			jDialog.setContentPane(getJContentPane());
		}
		return jDialog;
	}
	
	public Operator getInputValue() {
	    Operator value = null;
	    int operatorId = Integer.parseInt(OperatorIdjTextField.getText());
	    String operatorName = OperatorNamejTextField.getText().trim();
	    String operatorLevel = OperatorLeveljComboBox.getSelectedItem().toString().trim();
	    String password = OperatorPwdjPasswordField.getText().trim();
	    
	    

	    value = new Operator(operatorId,operatorName,operatorLevel,password);
	    return value;
	  }

	/**
	 * This method initializes jContentPane	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			OperatorIdjLabel = new JLabel();
			OperatorIdjLabel.setBounds(new java.awt.Rectangle(15,61,93,16));
			OperatorIdjLabel.setText("操作员ID:");
			OperatorLeveljLabel = new JLabel();
			OperatorLeveljLabel.setBounds(new java.awt.Rectangle(15,195,92,19));
			OperatorLeveljLabel.setText("操作员权限:");
			AdvancedInfojLabel = new JLabel();
			AdvancedInfojLabel.setBounds(new java.awt.Rectangle(16,165,76,16));
			AdvancedInfojLabel.setText("进阶信息");
			BasicInfojLabel = new JLabel();
			BasicInfojLabel.setBounds(new java.awt.Rectangle(15,15,75,16));
			BasicInfojLabel.setText("基  本  信  息");
			OperatorPwdjLabel = new JLabel();
			OperatorPwdjLabel.setBounds(new java.awt.Rectangle(15,119,91,17));
			OperatorPwdjLabel.setText("操作员口令:");
			OperatorNamejLabel = new JLabel();
			OperatorNamejLabel.setBounds(new java.awt.Rectangle(15,90,91,16));
			OperatorNamejLabel.setText("操作员姓名:");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(OperatorNamejLabel, null);
			jContentPane.add(getOperatorNamejTextField(), null);
			jContentPane.add(OperatorPwdjLabel, null);
			jContentPane.add(getOperatorPwdjPasswordField(), null);
			jContentPane.add(BasicInfojLabel, null);
			jContentPane.add(AdvancedInfojLabel, null);
			jContentPane.add(OperatorLeveljLabel, null);
			jContentPane.add(getOperatorLeveljComboBox(), null);
			jContentPane.add(getConfirmjButton(), null);
			jContentPane.add(getCanceljButton(), null);
			jContentPane.add(OperatorIdjLabel, null);
			jContentPane.add(getOperatorIdjTextField(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes OperatorNamejTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	public JTextField getOperatorNamejTextField() {
		if (OperatorNamejTextField == null) {
			OperatorNamejTextField = new JTextField();
			OperatorNamejTextField.setBounds(new java.awt.Rectangle(120,88,149,18));
		}
		return OperatorNamejTextField;
	}

	/**
	 * This method initializes OperatorPwdjPasswordField	
	 * 	
	 * @return javax.swing.JPasswordField	
	 */
	public JPasswordField getOperatorPwdjPasswordField() {
		if (OperatorPwdjPasswordField == null) {
			OperatorPwdjPasswordField = new JPasswordField();
			OperatorPwdjPasswordField.setBounds(new java.awt.Rectangle(119,120,151,17));
		}
		return OperatorPwdjPasswordField;
	}

	/**
	 * This method initializes OperatorLeveljComboBox	
	 * 	
	 * @return javax.swing.JComboBox	
	 */
	public JComboBox getOperatorLeveljComboBox() {
		if (OperatorLeveljComboBox == null) {
			OperatorLeveljComboBox = new JComboBox();
			OperatorLeveljComboBox.addItem("前台管理员");
			OperatorLeveljComboBox.addItem("超级管理员");
			OperatorLeveljComboBox.setBounds(new java.awt.Rectangle(121,195,151,17));
		}
		return OperatorLeveljComboBox;
	}

	/**
	 * This method initializes ConfirmjButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getConfirmjButton() {
		if (ConfirmjButton == null) {
			ConfirmjButton = new JButton();
			ConfirmjButton.setBounds(new java.awt.Rectangle(16,255,78,31));
			ConfirmjButton.setText("确定");
			ConfirmjButton.addActionListener(new java.awt.event.ActionListener() {
		        public void actionPerformed(java.awt.event.ActionEvent e) {
		          Operator value = getInputValue();
		          OperatorSettingDao dao = new OperatorSettingDao();
		          if (checkInput()) {
		            if (getJDialog().getTitle().equals("添加服务员")) {
		              System.out.println("***********************************************");
		              if (dao.insertOperatorInfo(value)) {
		                JOptionPane.showMessageDialog(null, "数据追加成功", "提示信息",
		                    JOptionPane.YES_OPTION);
		                getJDialog().dispose();
		              }
		              } else {
		                JOptionPane.showMessageDialog(null, "数据追加失败", "提示信息",
		                    JOptionPane.YES_OPTION);
		              }
		          }

			    }
		      });
		}
		return ConfirmjButton;
	}

	/**
	 * This method initializes CanceljButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getCanceljButton() {
		if (CanceljButton == null) {
			CanceljButton = new JButton();
			CanceljButton.setBounds(new java.awt.Rectangle(196,254,77,32));
			CanceljButton.setText("取消");
			CanceljButton.addActionListener(new java.awt.event.ActionListener() {
		        public void actionPerformed(java.awt.event.ActionEvent e) {
		          getJDialog().dispose();
		        }
		      });
		}
		return CanceljButton;
	}

	/**
	 * This method initializes OperatorIdjTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	public JTextField getOperatorIdjTextField() {
		if (OperatorIdjTextField == null) {
			OperatorIdjTextField = new JTextField();
			OperatorIdjTextField.setBounds(new java.awt.Rectangle(120,61,153,16));
		}
		return OperatorIdjTextField;
	}
	
	public boolean checkInput() {
	    boolean flag = false;
        Check check = new Check();
        if (check.checkInputIsNull(OperatorIdjTextField.getText())){
             JOptionPane.showMessageDialog(null, "管理员ID不能为空且必须为数字", "提示信息",JOptionPane.YES_OPTION);
             OperatorIdjTextField.requestFocus();
			 return false;
	    } 
        else 
	    	if (check.checkInputIsNull(OperatorNamejTextField.getText())) {
			JOptionPane.showMessageDialog(null, "管理员姓名不能为空", "提示信息",JOptionPane.YES_OPTION);
			OperatorNamejTextField.requestFocus();
			return false;
	    	}
	    	else 
		    	if (check.checkInputIsNull(OperatorPwdjPasswordField.getText())) {
				JOptionPane.showMessageDialog(null, "管理员姓名不能为空", "提示信息",JOptionPane.YES_OPTION);
				OperatorNamejTextField.requestFocus();
				return false;
		    	}
        return true;
	}


	
}

⌨️ 快捷键说明

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