Check out example codes for "show menuitem when menu hovered javafx". It will help you in understanding the concepts better.

Code Example 1

HBox container = (HBox) menubar.lookup("HBox");
		for(int i=0;i<container.getChildren().size();i++) {
			Node parentNode = container.getChildren().get(i);
			Menu menu = menubar.getMenus().get(i);
			parentNode.setOnMouseMoved(e->{
				menu.show();
			});
		}

Learn ReactJs, React Native from akashmittal.com