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

📄 userbaseoper.java

📁 好的超市源码供大家下载
💻 JAVA
字号:
package view.dialog.dialogoper;

import javax.swing.JOptionPane;

import view.com.CheckInputText;
import view.dialog.basedialog.UserBaseDialog;
import vo.UserPwdVo;

/**
 * 用户基类操作
 * @author linfeng
 *
 */
public class UserBaseOper extends UserBaseDialog{

  
  /**
   * 初始化各种文本框的值
   */
  public static void initialTextValue() {
    user_id.setText("");
    user_name.setText("");
    user_pwd.setText("");
    phone.setText("");

  }
  
  /**
   * 修改文本框的值
   */
  public static void initialModifyValue(){
    user_id.setText(tableData[0]);
    user_name.setText(tableData[1]);
    user_pwd.setText(tableData[2]);
    user_type.setSelectedItem(tableData[3]);
    phone.setText(tableData[4]);

  }
  
  /**
   * 对用户输入的值进行核对
   * @return 
   */
  public static boolean checkInputValue() {
    CheckInputText check = new CheckInputText();
    if (check.checkInputIsNull(user_id.getText())) {
      //跳出提示对话框
      JOptionPane.showMessageDialog(null, "用户编号不能为空", "message",
          JOptionPane.YES_OPTION);
      user_id.requestFocus();
      return false;
    }
    if (check.checkInputIsNull(user_name.getText())) {
      JOptionPane.showMessageDialog(null, "用户名称不能为空", "message",
          JOptionPane.YES_OPTION);
      user_name.requestFocus();
      return false;
    }
    if (check.checkInputIsNull(user_pwd.getText())) {
      JOptionPane.showMessageDialog(null, "用户密码不能为空", "message",
          JOptionPane.YES_OPTION);
      user_pwd.requestFocus();
      return false;
    }
    if (check.checkInputIsNull(phone.getText())) {
      JOptionPane.showMessageDialog(null, "用户电话不能为空", "message",
          JOptionPane.YES_OPTION);
      phone.requestFocus();
      return false;
    }
    return true;
  }
  
  /**
   * 根据输入的用户编号的值取得用户密码的全部信息
   * @return value UserPwdVo对象
   */
  public static UserPwdVo getInputTextValue() {
    UserPwdVo value;
    int userId = Integer.parseInt(user_id.getText());
    String userName = user_name.getText();
    String userType = user_type.getSelectedItem().toString();
    String userPwd = user_pwd.getText();
    long userPhone = Long.parseLong(phone.getText());

    value = new UserPwdVo(userId, userName, userType, userPwd, userPhone);
    return value;
  }

}

⌨️ 快捷键说明

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