zoukankan      html  css  js  c++  java
  • 等价类划分方法及其示例(2)

    package threebox;
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.TextField;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.paint.Color;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    import javafx.stage.Stage;
    
    
    
    public class lab4 extends Application{
        public static void main(String[]args)
        {
            lab4.launch(args);
        }
        public void start(Stage primaryStage)
        {
            primaryStage.setTitle("Transition Lab");
            AnchorPane anchorpane = new AnchorPane();
            Button btn = new Button( );
            btn.setText("OK");
            AnchorPane.setTopAnchor(btn, 350.0);
            AnchorPane.setLeftAnchor(btn, 250.0);
        
            Text text = new Text("user name:");
            text.setFont(new Font(24));
            text.setFill(Color.BLACK);
            AnchorPane.setTopAnchor(text, 50.0);
            AnchorPane.setLeftAnchor(text, 50.0);
            final TextField textf = new TextField();
            AnchorPane.setTopAnchor(textf, 50.0);
            AnchorPane.setLeftAnchor(textf, 300.0);
            
            Text text2 = new Text("password:");
            text2.setFill(Color.BLACK);
            text2.setFont(new Font(24));
            AnchorPane.setTopAnchor(text2, 150.0);
            AnchorPane.setLeftAnchor(text2, 50.0);
            final TextField textf2 = new TextField();
            AnchorPane.setTopAnchor(textf2, 150.0);
            AnchorPane.setLeftAnchor(textf2, 300.0);
            
            Text text3 = new Text("verification code:");
            text3.setFill(Color.BLACK);
            text3.setFont(new Font(24));
            AnchorPane.setTopAnchor(text3, 250.0);
            AnchorPane.setLeftAnchor(text3, 50.0);
            text3.setX(50);
            text3.setY(250);
            final TextField textf3 = new TextField();
            AnchorPane.setTopAnchor(textf3, 250.0);
            AnchorPane.setLeftAnchor(textf3, 300.0);
            
            btn.setOnAction( new EventHandler<ActionEvent>( ) {
                public void handle(ActionEvent actEvt) {
                    
                    String sql1 = textf.getText();
                    String sql2=new String();
                    sql2=textf2.getText();
                    String sql3=new String();
                    sql3=textf3.getText();
                    int length1=sql1.length();
                    int length2=sql2.length();
                    int length3=sql3.length();
                    if((length1<7)&&(length1>0)&&(length2<7)&&(length2>0)&&(length3<7)&&(length3>0)){
                        System.out.println("the length is not enough");
                    }  
                    
                    for(int i= 0;i<=length1;i++){
                    if((sql1.charAt(i)<49)||((sql1.charAt(i)>54)&&(sql1.charAt(i)<65))||((sql1.charAt(i)>90)&&(sql1.charAt(i)<97))||(sql1.charAt(i)>122))
                    {
                        System.out.println("not the real character");
                    }
                    }
                    
                    for(int i= 0;i<=length2;i++){
                    if((sql2.charAt(i)<49)||((sql2.charAt(i)>54)&&(sql2.charAt(i)<65))||((sql2.charAt(i)>90)&&(sql2.charAt(i)<97))||(sql2.charAt(i)>122))
                    {
                        System.out.println("not the real character");
                    }
                    }
                    
                    
                    for(int i= 0;i<=length3;i++){
                    if((sql3.charAt(i)<49)||((sql3.charAt(i)>54)&&(sql3.charAt(i)<65))||((sql3.charAt(i)>90)&&(sql3.charAt(i)<97))||(sql3.charAt(i)>122))
                    {
                        System.out.println("not the real character");
                    }
                    }    
                }
                } );
            
            anchorpane.getChildren().addAll(btn, text,textf,text2,textf2,text3,textf3);
            primaryStage.setScene(new Scene(anchorpane, 550, 400));
            primaryStage.show();
        }
    
    }
    当换成三个框时的代码与界面如上,下面是测试用例:
     
     
     
     
     
     
  • 相关阅读:
    移动端HTML5音频与视频问题及解决方案
    git did not exit cleanly
    移动端事件对象touches的误区
    原创:CSS3技术-雪碧图自适应缩放与精灵动画方案
    H5+JS+CSS3 综合应用
    深入理解CSS3 Animation 帧动画
    在 MacOS 中使用 multipass 安装 microk8s 环境
    [译] Design patterns for container-based distributed systems
    Sangmado 公共基础类库
    Redola.Rpc 集成 Consul 服务发现
  • 原文地址:https://www.cnblogs.com/2522150225qq/p/4376975.html
Copyright © 2011-2022 走看看