W
W
WannaCreative2016-08-23 14:17:04
Java
WannaCreative, 2016-08-23 14:17:04

Why doesn't Thread.sleep work?

public class Controller implements Initializable
{
    public static String login = "EVA";

    @FXML
    private Button btn;

    @FXML
    private TextField loginfield;

    @FXML
    private Label result;


    public void initialize(URL fxmlFileLocation, ResourceBundle resources)
    {
        loginfield.setStyle("-fx-font: 25 calibri");

        btn.setOnAction(
                event ->
                {
                    if (loginfield.getText().equals(login))
                    {
                        result.setText("Your login is right");
                        result.setText("Logged in");
                    }

                    else if (loginfield.getText().isEmpty())
                    {
                        result.setText("You have typed nothing");
                    }

                    else if (loginfield.getText() != login)
                    {
                        result.setText("Your login isn't right");
                    }
                }
        );
    }
}

Displays InterruptedException
I did not find anything on the Internet
How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WannaCreative, 2016-08-24
@WannaCreative

I figured I need to use a timer
import java.util.Timer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question