Hi, I'm trying to load a menubar by calling the file, visual.fxml, as I do to load the menubar, in the same scene or stage as the document, which I can correct, I'm new to this, and I need some guidance. Here I leave my code. thanks:
public void start(Stage primaryStage) throws IOException{
primaryStage.setTitle("THANOS V1.0 ");
AnchorPane root = new AnchorPane();
root = FXMLLoader.load(getClass().getResource("Visualizar.fxml"));
Scene scene = new Scene(root, Color.WHITE);
primaryStage.setScene(scene);
primaryStage.show();
MenuBar menuBar = new MenuBar();//Barramenu
BorderPane raiz = new BorderPane();
raiz.setTop(menuBar);
Menu Agregar = new Menu("Archivo"); //creando Menu archivo
MenuItem PrimerItem= new MenuItem("Agregar Datos"); //creando menu item
Agregar.getItems().addAll(PrimerItem);
menuBar.getMenus().addAll(Agregar);
}