As Given below I have to write one method in java before calculation performing. I am going to check if that string contains only numbers, but if I am going to enter floating points values it will not going to validate it.
Please suggest me right source code for it.
if (Purchase_Paid.getText().matches("[0-9]+")) {
Global_Total = Float.parseFloat(Purchase_Amount.getText());
Globle_paidAmount = Float.parseFloat(Purchase_Paid.getText());
GlobleOutStandingAmount = (Global_Total - Globle_paidAmount);
Purchase_Outstanding.setText(String.valueOf(GlobleOutStandingAmount));
} else {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Validation");
alert.setHeaderText(null);
alert.setContentText("Please enter only numbers in Paid fields");
alert.showAndWait();
}