import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.stage.Stage; /** * * @author lans */ public class LongMenuFail extends Application { @Override public void start(Stage primaryStage) throws Exception { Scene scene; Menu fileMenu; Menu editMenu; MenuBar menuBar = new MenuBar(); fileMenu = new Menu("LongMenu"); menuBar.getMenus().clear(); menuBar.getMenus().addAll(fileMenu); for (int i = 1; i <= 50; i++) { MenuItem menuitem = new MenuItem(); menuitem.setText("MenuItem-" + i); fileMenu.getItems().add(menuitem); } Group group = new Group(menuBar); scene = new Scene(group, 400, 400); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }