zoukankan      html  css  js  c++  java
  • 软件测试技术第二周课堂等价类习题

    有效等价类: 长度:1到6

             字符:a-z,A-Z,0-9

    无效等价类 长度:0,7

             字符:英文/数字以外字符,控制字符,标点符号

     

    部分代码如下:

    public void start(Stage stage)throws Exception {

       

            stage.setTitle("TEST");

            AnchorPane root = new AnchorPane();

            Scene scene = new Scene(root, 500, 300);

            scene.setFill(Color.WHITE);

           

            Text usename= new Text("用户名:");

            usename.setFont(Font.font ("Serif", 28));

            AnchorPane.setTopAnchor(usename, 100.0);

            AnchorPane.setLeftAnchor(usename, 50.0);

           

            Text tips= new Text("提示:");

            tips.setFont(Font.font ("Serif", 28));

            AnchorPane.setTopAnchor(tips, 150.0);

            AnchorPane.setLeftAnchor(tips, 50.0);

           

            final TextField textblock=new TextField();

            AnchorPane.setTopAnchor(textblock, 105.0);

            AnchorPane.setLeftAnchor(textblock, 200.0);

           

            final TextField textblock2=new TextField();

            AnchorPane.setTopAnchor(textblock2, 155.0);

            AnchorPane.setLeftAnchor(textblock2, 200.0);

           

            Button button = new Button("检验");

            AnchorPane.setTopAnchor(button, 105.0);

            AnchorPane.setRightAnchor(button, 50.0);

           

            button.setOnAction( new EventHandler<ActionEvent>( ) {

                public void handle(ActionEvent actEvt) {       

                    final String input;

                    input = textblock.getText();

                    if(input.length() > 6|| input.length() < 1){

                      textblock2.setText("er1:长度应为1-6");

                    }

                    else if(!isRegularRptCode(input,"[a-z,A-Z,0-9]*")){

                      textblock2.setText("er2: 字符应为a-z,A-Z,0-9");

                    }

                    else{

                      textblock2.setText("OK!!");

                    }

                }

            } );

            root.getChildren().addAll(usename,tips,textblock,textblock2,button);

            stage.setScene(scene);

            stage.show();

        }

    }

    结果截图:

                           

  • 相关阅读:
    CSS3属性transform详解之(旋转:rotate,缩放:scale,倾斜:skew,移动:translate)
    MySQL<添加、更新与删除数据>
    MySQL<数据库和表的基本操作>
    MySQL<数据库入门>
    MySql阶段案例
    Mysql综合案例
    Mysql课后思考题
    Java课后思考题
    Java课后简答题
    超全面的JavaWeb笔记day23<AJAX>
  • 原文地址:https://www.cnblogs.com/wangdongT-T/p/4357912.html
Copyright © 2011-2022 走看看