remove menu items once menu not hovering javafx code example
Example: show menuitem when menu hovered javafx
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();
});
}