package com.testserial;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {
    @Override
    public void start(Stage stage) {
        try {
            // 1. Load the FXML
            FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/testserial/MainView.fxml"));
            Parent root = loader.load();

            // 2. Setup the Scene
            Scene scene = new Scene(root, 640, 480);
            
            // 3. Configure the Stage
            stage.setTitle("Serial Monitor");
            stage.setScene(scene);
            stage.show();
            
            System.out.println("Application started successfully!");
            
        } catch (Exception e) {
            System.err.println("FATAL ERROR: Could not load FXML file!");
            e.printStackTrace(); // This prints the EXACT line causing the issue
        }
    }

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