I am a beginner Java programmer and have a question and really appreciate if you can help me. I use Netbeans and in default JavaFX fxml Application, there is a button that prints "Hello world" when it is pressed.
@FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
label.setText("Hello World!");
}
Is there a way to change the color of button (using button.setStyle() ), exactly 5 seconds after it is first pressed? Meantime, I want the button remains functional during that 5 seconds and prints "Hello world" when it is pressed.
I tried use sleep() function but then the button would not be functional during that period. Is there is an alternative way to code this?