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

📄 feifa.java

📁 java+sql 图书管理系统
💻 JAVA
字号:
package MyLibraryok.books.untitled1;

import javax.swing.*;


public class Feifa {
//   Feifa feifa = new Feifa();
    JTextField field = new JTextField();
    String str = field.getText();

    public boolean feifabianhao(String str) {
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
//        for (int i = 0; i < str.length(); i++) {
//           ma[i] = str.charAt(i);
//       }
//
        if (str.length() > 10 || str.length() < 4) {
            JOptionPane.showMessageDialog(null, "图书编号必须输入并且输入4位到10位的数字!",
                                          "温馨提示",
                                          JOptionPane.ERROR_MESSAGE);
            return true;
        } else if (str.equals("")) {
            JOptionPane.showMessageDialog(null, "图书编号不能为空!", "温馨提示",
                                          JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }
    }

    public boolean feifatiaoxingma(String str) {
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
        if (str.length() > 10 || str.length() < 6) {
            JOptionPane.showMessageDialog(null, "条形码必须输入并且输入6位到10位的数字!",
                                          "温馨提示",
                                          JOptionPane.ERROR_MESSAGE);
            return true;
        } else if (str.equals("")) {
            JOptionPane.showMessageDialog(null, "条形码不能为空!", "温馨提示",
                                          JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }

    }

    public boolean feifamingcheng(String str) {
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
        for (int j = 0; j < str.length(); j++) {
            if ((ma[j] < 48) || (47 < ma[j] && ma[j] < 58) ||
                (57 < ma[j] && ma[j] < 65) || (90 < ma[j] && ma[j] < 97) ||
                (ma[j] < 66 && ma[j] > 91) ||
                (122 < ma[j] && ma[j] < 255)) {
                JOptionPane.showMessageDialog(null, "图书名称不能有非法字符!", "温馨提示",
                                              JOptionPane.ERROR_MESSAGE);
                return true;
            }
        }
        if (str.length() == 0) {
            JOptionPane.showMessageDialog(null, "图书名称不能为空!", "温馨提示",
                                          JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }
    }

    public boolean feifazuozhe(String str) {
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
        for (int j = 0; j < str.length(); j++) {
            if ((ma[j] < 48) || (ma[j] > 47 && ma[j] < 65) ||
                (ma[j] > 90 && ma[j] < 97) || (ma[j] > 122 && ma[j] < 255)) {
                JOptionPane.showMessageDialog(null, "作者不能有非法字符!", "温馨提示",
                                              JOptionPane.ERROR_MESSAGE);
                return true;
            }
        }
        if (str.equals("")) {
            JOptionPane.showMessageDialog(null, "作者不能为空!",
                                          "温馨提示", JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }
    }

    public boolean feifajiage(String str) {
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
        for (int j = 0; j < str.length(); j++) {
            if ((ma[j] > 57) || (ma[j] < 46) ||
                ma[j] > 46 && ma[j] < 48) {
                JOptionPane.showMessageDialog(null, "价格必须输入数字!",
                                              "温馨提示", JOptionPane.ERROR_MESSAGE);
                return true;
            }
        }
        if (str.equals("")) {
            JOptionPane.showMessageDialog(null, "价格不能为空!",
                                          "温馨提示", JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }
    }

//    public boolean feifacunfangweiz(String str) {
//        char[] ma = new char[str.length()];
//        for (int i = 0; i < str.length(); i++) {
//            ma[i] = str.charAt(i);
//        }
//        for (int j = 0; j < str.length(); j++) {
//            if ((ma[j] < 48) || (ma[j] > 47 && ma[j] < 65) ||
//                (ma[j] > 90 && ma[j] < 97) || (ma[j] > 122 && ma[j] < 255)) {
//                JOptionPane.showMessageDialog(null, "存放位置不能有非法字符!", "温馨提示",
//                                              JOptionPane.ERROR_MESSAGE);
//            }
//        }
//        if (str.equals("")) {
//            JOptionPane.showMessageDialog(null, "存放位置不能为空!",
//                                          "温馨提示", JOptionPane.ERROR_MESSAGE);
//            return true;
//        } else {
//            return false;
//        }
//
//    }

    public boolean feifaleibie(String str) {
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
        for (int j = 0; j < str.length(); j++) {
            if ((ma[j] < 48) || (ma[j] > 47 && ma[j] < 65) ||
                (ma[j] > 90 && ma[j] < 97) || (ma[j] > 122 && ma[j] < 255)) {
                JOptionPane.showMessageDialog(null, "图书类型不能有非法字符!", "温馨提示",
                                              JOptionPane.ERROR_MESSAGE);
                return true;
            }

        }
        if (str.equals("")) {
            JOptionPane.showMessageDialog(null, "图书类型不能为空!",
                                          "温馨提示", JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }
    }


    public boolean feifachubanshe(String str) {
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
        for (int j = 0; j < str.length(); j++) {
            if ((ma[j] < 65) ||
                (ma[j] > 90 && ma[j] < 97) || (ma[j] > 122 && ma[j] < 255)) {
                JOptionPane.showMessageDialog(null, "出版社不能有非法字符!", "温馨提示",
                                              JOptionPane.ERROR_MESSAGE);
                return true;
            }
        }
        if (str.equals("")) {
            JOptionPane.showMessageDialog(null, "出版社不能为空!",
                                          "温馨提示", JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }
    }


    public boolean Feifarukushijian(String str) {
        char ch;
        char[] ma = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            ma[i] = str.charAt(i);
        }
        for (int j = 0; j < str.length(); j++) {
            if ((ma[j] < 45) || (ma[j] > 58) ||
                (str.getBytes().length == 2 * str.length())) {
                JOptionPane.showMessageDialog(null, "入库日期不能有非法字符!",
                                              "温馨提示", JOptionPane.ERROR_MESSAGE);
                return true;
            }
        }
        if (str.equals("")) {
            JOptionPane.showMessageDialog(null, "入库日期不能为空!",
                                          "温馨提示", JOptionPane.ERROR_MESSAGE);
            return true;
        } else {
            return false;
        }
    }

    /**
     * feifarukushijian
     *
     * @param strRKSJ String
     * @return boolean
     */
    public boolean feifarukushijian(String strRKSJ) {
        return false;
    }

}

⌨️ 快捷键说明

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