zoukankan      html  css  js  c++  java
  • UserForm扩展问题

    关于userform的扩展,这次是在三个输入框里输入密码,密码的格式都为:

      允许1到6个英文字符或数字,按OK结束
     
    等价类划分:
     

    等价类表:

    测试代码:

    Button btn = new Button("OK");
    AnchorPane.setTopAnchor(btn, 140.0);
    AnchorPane.setLeftAnchor(btn, 130.0);
    root.getChildren().add(btn);

    btn.setOnAction(new EventHandler<ActionEvent>(){
    @Override
    public void handle(ActionEvent actEvt) {
    if((check(t2.getText().toString())))
    System.out.println("true");
    else
    System.out.println("false");
    if((check(t4.getText().toString())))
    System.out.println("true");
    else
    System.out.println("false");
    if((check(t6.getText().toString())))
    System.out.println("true");
    else
    System.out.println("false");
    }
    });

    public boolean check(String s){
    char array[] = new char[s.length()];
    array = s.toCharArray();
    if (s.length() < 1 || s.length() > 6)
    return false;
    if (s.length() != 0){
    for (int i = 0; i < s.length(); i++){
    if(!Character.isDigit(array[i]) && !Character.isAlphabetic(array[i]))
    return false;
    }
    }
    return true;
    }

    测试用例:

    测试结果:

    与之前那个UserForm相比,这个测试其实没什么区别,只是在数量上多了一些而已。

  • 相关阅读:
    ▶ 0001 No application 'E:wwwgolog' found in your GOPATH
    beego路由
    go sync.WaitGroup
    idea修改filetype
    deepin添加设置快捷键
    mysql数据库被攻击
    linux桌面系统的约定
    deepin把vscode设为默认文本应用
    linux应用管理
    当你在工作中失去动力时该怎么办?
  • 原文地址:https://www.cnblogs.com/HCS1995/p/4376276.html
Copyright © 2011-2022 走看看