Код: Выделить всё
public class NewMain extends Application {
@Override
public void start(Stage stage) {
MenuBar menuBar = new MenuBar();
Menu fileMenu = new Menu("File");
MenuItem fooItem = new MenuItem("Foo");
fooItem.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN));
fooItem.setOnAction(e -> System.out.println("Ctrl+Shift+S triggered"));
MenuItem barItem = new MenuItem("Bar");
barItem.setAccelerator(new KeyCodeCombination(KeyCode.A, KeyCombination.CONTROL_DOWN));
barItem.setOnAction(e -> System.out.println("Ctrl+A triggered"));
fileMenu.getItems().addAll(fooItem, barItem);
menuBar.getMenus().add(fileMenu);
BorderPane root = new BorderPane();
root.setTop(menuBar);
Scene scene = new Scene(root, 400, 300);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Может кто-нибудь сказать, как это исправить?
Подробнее здесь: https://stackoverflow.com/questions/793 ... -in-javafx
Мобильная версия