I am using a two dimensional array of JTextFields to take in x y points, and graph them on a JPanel.
What is the best way to either limit the input to numbers, or prevent letter from blowing up my program?
Here is a snippet of code, that does not like when an letter is entered.
Float smallX = Float.parseFloat(xyInput[0][0].getText());
for (Integer i = 0; i < xyInput.length; i++) {
String number = xyInput[i][0].getText();
Float testX = Float.parseFloat(number);
if (smallX > testX) {
smallX = testX;
System.out.println("smallX = " + smallX);
}
}
Thanks for all your help!