58){ // Judge whether the input character " />
Boolean b = true;
if(s = = " " | | s . charat(0)& lt; 47||s.charAt(0)>58){ // Judge whether the input character is legal.
Labell.setText ("Please enter it correctly!" ); //Set the string of the label to prompt the user.
Return;
}
long n = long . parse long(s); //convert s to long.
If (n & lt3){
Labell.setText ("Please enter an integer greater than three!" ); //Set the string of the label to prompt the user.
Return;
}
for(int I = 2; I< math.sqrt (n); I++){// Judge whether n is a prime number, if so, b is true, otherwise b is false.
if(n%i==0){
B = false;
Break;
}
If (b){
Labell.setText(s+ "is a prime number"); //Set the string of the label to prompt the user.
}
else { labell . settext(s+" not "); }//Set the string of the label to prompt the user.
text . select all(); //Select all the text in this text component.
text . force focus(); //Position the cursor in the input box.
}