package org.cybuch.jbot.gui;
import org.cybuch.jbot.utils.Global;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
public class JBot extends Application {
private Stage primaryStage;
private AnchorPane rootLayout;
@Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
this.primaryStage.setTitle("jBot");
try {
FXMLLoader loader = new FXMLLoader(
JBot.class.getResource("Main.fxml"));
rootLayout = (AnchorPane) loader.load();
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setResizable(false);
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
public void handle(final KeyEvent keyEvent) {
if (keyEvent.getCode() == KeyCode.F12) {
if (!Global.LOCKED) {
Global.LOCKED = true;
keyEvent.consume();
return;
}
System.out.println("released");
keyEvent.consume();
}
}
});
} catch (Exception e) {
e.printStackTrace();
return;
}
}
public static void main(String[] args) {
launch(args);
}
}