package lagerverwaltung;
import java.util.Locale;
import java.util.ResourceBundle;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import lagerverwaltung.hmi.Language;
public class LagerverwaltungsApp extends Application{
//private static OPCUAWorker opcuaWorker;
@FXML BorderPane borderPane;
private String language = "de";
@Override
public void start(Stage mainStage) throws Exception {
Language test = new Language();
test.languageProperty().addListener(new ChangeListener<Object>() {
@Override
public void changed(ObservableValue<?> o, Object oldVal, Object newVal) {
language = test.getLanguage();
System.out.println(language);
}
});
System.out.println(language);
Locale locale = new Locale(language);
ResourceBundle bundle = ResourceBundle.getBundle("lagerverwaltung.resources.LagerApp", locale);
Parent root = FXMLLoader.load(getClass().getResource("/lagerverwaltung/hmi/LagerApp.fxml"), bundle);
Scene scene = new Scene(root, 1920, 600);
mainStage.setScene(scene);
//borderPane.setCenter(FXMLLoader.load(getClass().getResource("/lagerverwaltung/hmi/Home.fxml")));
mainStage.show();
mainStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent windowEvent) {
close();
}
});
}
// on close
public static void close() {
// opcuaWorker.stop();
Platform.exit();
}
public static void main(String[] args) {
// opcuaWorker = new OPCUAWorker();
// Thread t = new Thread(opcuaWorker); // create thread
// t.start(); // start thread
LagerverwaltungsApp.launch(args);
}
}