dimanche 11 juin 2017

How do I check if my double field is filled in on a GUI in Java

Hey guys I'm currently having some issues making my program work correctly through it's GUI. I have three textfields which the user inputs "Firstname, Lastname, and Mass) Mass is a double and I'm trying to make the program tell the user when the field is not filled in properly. Because mass is a double I can't use ("") like i did previously for the name fields. I've tried several things so far.

if (Double.parseDouble(EnterMass.getText()) {
        TransactionDisplay.setText("There is a field which isn't filled in \nPlease fill in all fields then try again");     
        return;
    }

was my most recent attempt but it tells me double cannot be converted to boolean. Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire