43 lines
1 KiB
Java
43 lines
1 KiB
Java
package fr.alnotz.control;
|
|
|
|
import fr.alnotz.SystemInfo;
|
|
|
|
import javafx.application.Platform;
|
|
import javafx.event.ActionEvent;
|
|
import javafx.fxml.FXML;
|
|
import javafx.fxml.Initializable;
|
|
import javafx.scene.control.Button;
|
|
import javafx.scene.control.Label;
|
|
|
|
import java.net.URL;
|
|
import java.util.ResourceBundle;
|
|
|
|
public class MainControl implements Initializable {
|
|
private boolean hasClicked = false;
|
|
@FXML
|
|
private Label mainLabel = null;
|
|
@FXML
|
|
private Button mainButton = null;
|
|
@FXML
|
|
private void onClick(ActionEvent event){
|
|
if(hasClicked){
|
|
Platform.exit();
|
|
}else{
|
|
mainButton.setText("_Bye.");
|
|
hasClicked = true;
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
@FXML
|
|
public void initialize(URL url, ResourceBundle resourceBundle) {
|
|
final String txt = "Hello, JavaFX " +
|
|
SystemInfo.javaVersion() +
|
|
", running on Java " +
|
|
SystemInfo.javafxVersion() +
|
|
".";
|
|
mainLabel.setText(txt);
|
|
}
|
|
}
|