📜  如何在java代码示例中只接受数字和空格

📅  最后修改于: 2022-03-11 14:52:14.898000             🧑  作者: Mango

代码示例1
char text_in_patient_contact = evt.getKeyChar();
        if (Character.isDigit(text_in_patient_contact)||Character.isISOControl(text_in_patient_contact)) {
            medicine_name_input.requestFocus();
            patient_input_error.setText("");
        }
        else{
             patient_input_error.setText("Worong Phone");
        }