package fabrik.simulator.pic16f84;

import javafx.application.Application;

import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;

import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

import java.io.IOException;
import java.util.Objects;

public class CreateWindow extends Application {

    private static VBox table;
    public static GridPane grid = new GridPane();

    @Override
    public void start(Stage primaryStage) throws IOException {
        DataRegister.initDataRegister();
        table = Table.refresh();
        FXMLLoader codewindow = new FXMLLoader(CreateWindow.class.getResource("frontend.fxml"));
        Parent code = codewindow.load();

        grid.add(table, 1, 1);
        grid.add(code, 0, 1);

        grid.relocate(0, 0);

        grid.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styles.css")).toExternalForm());
        Scene scene = new Scene(grid, 1845, 800);
        primaryStage.setScene(scene);
        primaryStage.setTitle("Simulator");
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

    public static void refreshTable(Stage stage) {
        grid.getChildren().remove(table);
        table= Table.refresh();
        grid.add(table, 1, 1);
    }
}



