You can use:
float input1String = txtInput1.getText() == null ? 0.0f : Float.valueOf(txtInput1.getText().trim());
which can throw an exception if the value of yout Textfiled is not a float value
4
solved How can i change my Var to Float in GUI Java?