PackageThreebox;Importjavafx.application.Application;Importjavafx.event.ActionEvent;ImportJavafx.event.EventHandler;ImportJavafx.scene.Scene;ImportJavafx.scene.control.Button;ImportJavafx.scene.control.TextField;ImportJavafx.scene.layout.AnchorPane;ImportJavafx.scene.paint.Color;ImportJavafx.scene.text.Font;ImportJavafx.scene.text.Text;ImportJavafx.stage.Stage; Public classLab4extendsapplication{ Public Static voidMain (String[]args) {lab4.launch (args); } Public voidStart (Stage primarystage) {primarystage.settitle ("Transition Lab"); Anchorpane Anchorpane=NewAnchorpane (); Button btn=NewButton (); Btn.settext ("OK"); Anchorpane.settopanchor (BTN,350.0); Anchorpane.setleftanchor (BTN,250.0); Text text=NewText ("User name:"); Text.setfont (NewFont (24)); Text.setfill (Color.Black); Anchorpane.settopanchor (text,50.0); Anchorpane.setleftanchor (text,50.0); FinalTextField TEXTF =NewTextField (); Anchorpane.settopanchor (TEXTF,50.0); Anchorpane.setleftanchor (TEXTF,300.0); Text Text2=NewText ("Password:"); Text2.setfill (Color.Black); Text2.setfont (NewFont (24)); Anchorpane.settopanchor (Text2,150.0); Anchorpane.setleftanchor (Text2,50.0); FinalTextField TEXTF2 =NewTextField (); Anchorpane.settopanchor (TEXTF2,150.0); Anchorpane.setleftanchor (TEXTF2,300.0); Text Text3=NewText ("Verification Code:"); Text3.setfill (Color.Black); Text3.setfont (NewFont (24)); Anchorpane.settopanchor (Text3,250.0); Anchorpane.setleftanchor (Text3,50.0); Text3.setx (50); Text3.sety (250); FinalTextField TEXTF3 =NewTextField (); Anchorpane.settopanchor (TEXTF3,250.0); Anchorpane.setleftanchor (TEXTF3,300.0); Btn.setonaction (NewEventhandler<actionevent>( ) { Public voidhandle (ActionEvent actevt) {String SQL1=Textf.gettext (); String SQL2=NewString (); SQL2=Textf2.gettext (); String Sql3=NewString (); Sql3=Textf3.gettext (); intlength1=sql1.length (); intLength2=sql2.length (); intlength3=sql3.length (); if(length1<7) && (length1>0) && (length2<7) && (length2>0) && (length3<7 ) && (length3>0) {System.out.println ("The length is not enough"); } for(intI= 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(intI= 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(intI= 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 (NewScene (Anchorpane, 550, 400)); Primarystage.show (); }}
When you switch to the three-box code and interface as above, here is the test case:
Equivalence class partitioning methods and examples (2)