Hello mAineAc.
Firstly I'm probably newer to java than you but a few things ocurred to me when I saw this.
Here's some things to try:
Isn't an exception best dealt with using something like:
Code:
try {
while (testNumberField.getText()!=null) {
PrimeTest();
}
} catch (NumberFormatException e) {
System.out.println("This is not a number!"); // or answer.setText etc.
}
Another thought - can you perhaps test for NaN ? (Don't know if that can be done but it's the first place I'd look)
This might have helped sorry if it hasn't.