import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class Bug extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { ContextMenu contextMenu = new ContextMenu(new MenuItem("_My menu item")); TextArea textArea = new TextArea(); textArea.setContextMenu(contextMenu); BorderPane borderPane = new BorderPane(); borderPane.setCenter(textArea); Scene scene = new Scene(borderPane); stage.setTitle("MenuApp"); stage.setScene(scene); stage.show(); } }