Java Code Examples for javafx.scene.control.Menu#setMnemonicParsing()
The following examples show how to use
javafx.scene.control.Menu#setMnemonicParsing() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogFX.java From LogFX with GNU General Public License v3.0 | 6 votes |
@MustCallOnJavaFXThread private Menu fileMenu() { Menu menu = new Menu( "_File" ); menu.setMnemonicParsing( true ); MenuItem open = new MenuItem( "_Open File" ); open.setAccelerator( new KeyCodeCombination( KeyCode.O, KeyCombination.SHORTCUT_DOWN ) ); open.setMnemonicParsing( true ); open.setOnAction( ( event ) -> new FileOpener( stage, this::open ) ); MenuItem showLogFxLog = new MenuItem( "Open LogFX Log" ); showLogFxLog.setAccelerator( new KeyCodeCombination( KeyCode.O, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN ) ); showLogFxLog.setOnAction( ( event ) -> open( LogFXLogFactory.INSTANCE.getLogFilePath().toFile() ) ); MenuItem close = new MenuItem( "E_xit" ); close.setAccelerator( new KeyCodeCombination( KeyCode.W, KeyCombination.SHIFT_DOWN, KeyCombination.SHORTCUT_DOWN ) ); close.setMnemonicParsing( true ); close.setOnAction( ( event ) -> stage.close() ); menu.getItems().addAll( open, showLogFxLog, close ); return menu; }
Example 2
Source File: LogFX.java From LogFX with GNU General Public License v3.0 | 5 votes |
@MustCallOnJavaFXThread private Menu helpMenu() { Menu menu = new Menu( "_Help" ); menu.setMnemonicParsing( true ); MenuItem about = new MenuItem( "_About LogFX" ); about.setOnAction( ( event ) -> new AboutLogFXView( getHostServices() ).show() ); menu.getItems().addAll( about ); return menu; }
Example 3
Source File: LogFX.java From LogFX with GNU General Public License v3.0 | 5 votes |
@MustCallOnJavaFXThread private Menu viewMenu() { Menu menu = new Menu( "_View" ); menu.setMnemonicParsing( true ); CheckMenuItem highlight = new CheckMenuItem( "_Highlight Options" ); highlight.setAccelerator( new KeyCodeCombination( KeyCode.H, KeyCombination.SHORTCUT_DOWN ) ); highlight.setMnemonicParsing( true ); bindMenuItemToDialog( highlight, () -> showHighlightOptionsDialog( highlightOptions ) ); MenuItem orientation = new MenuItem( "Switch Pane Orientation" ); orientation.setAccelerator( new KeyCodeCombination( KeyCode.S, KeyCombination.SHIFT_DOWN, KeyCombination.SHORTCUT_DOWN ) ); orientation.setOnAction( event -> logsPane.switchOrientation() ); CheckMenuItem font = new CheckMenuItem( "Fon_t" ); font.setAccelerator( new KeyCodeCombination( KeyCode.F, KeyCombination.SHIFT_DOWN, KeyCombination.SHORTCUT_DOWN ) ); font.setMnemonicParsing( true ); bindMenuItemToDialog( font, () -> showFontPicker( config.fontProperty() ) ); CheckMenuItem filter = new CheckMenuItem( "Enable _filters" ); filter.setAccelerator( new KeyCodeCombination( KeyCode.F, KeyCombination.SHORTCUT_DOWN ) ); filter.setMnemonicParsing( true ); filter.selectedProperty().bindBidirectional( config.filtersEnabledProperty() ); MenuItem showContextMenu = new MenuItem( "Show Context Menu" ); showContextMenu.setAccelerator( new KeyCodeCombination( KeyCode.E, KeyCombination.SHORTCUT_DOWN ) ); showContextMenu.setOnAction( event -> logsPane.showContextMenu() ); menu.getItems().addAll( highlight, orientation, font, filter, showContextMenu ); return menu; }
Example 4
Source File: MyMenuBar.java From classpy with MIT License | 5 votes |
private void createFileMenu() { Menu fileMenu = new Menu("_File"); fileMenu.getItems().add(createOpenMenu()); fileMenu.getItems().add(createRecentMenu()); fileMenu.setMnemonicParsing(true); getMenus().add(fileMenu); }
Example 5
Source File: MyMenuBar.java From classpy with MIT License | 5 votes |
private Menu createOpenMenu() { ImageView folderIcon = ImageHelper.createImageView("/folder.png"); Menu openMenu = new Menu("_Open", folderIcon); openMenu.getItems().add(createOpenFolderItem(folderIcon)); openMenu.getItems().add(createOpenMenuItem(FileType.JAVA_JAR)); openMenu.getItems().add(createOpenMenuItem(FileType.JAVA_JMOD)); openMenu.getItems().add(createOpenMenuItem(FileType.JAVA_CLASS)); openMenu.getItems().add(createOpenMenuItem(FileType.LUA_BC)); openMenu.getItems().add(createOpenMenuItem(FileType.WASM)); openMenu.getItems().add(createOpenMenuItem(FileType.BITCOIN_BLOCK)); openMenu.getItems().add(createOpenMenuItem(FileType.BITCOIN_TX)); openMenu.setMnemonicParsing(true); return openMenu; }
Example 6
Source File: MyMenuBar.java From classpy with MIT License | 5 votes |
private Menu createRecentMenu() { Menu recentMenu = new Menu("Open _Recent", ImageHelper.createImageView("/clock.png")); for (RecentFile rf : RecentFiles.INSTANCE.getAll()) { ImageView icon = new ImageView(rf.type.icon); MenuItem menuItem = new MenuItem(rf.url.toString(), icon); menuItem.setOnAction(e -> onOpenFile.accept(rf.type, rf.url)); recentMenu.getItems().add(menuItem); } recentMenu.setMnemonicParsing(true); return recentMenu; }
Example 7
Source File: MyMenuBar.java From classpy with MIT License | 5 votes |
private void createWindowMenu() { MenuItem newWinMenuItem = new MenuItem("New Window"); newWinMenuItem.setOnAction(e -> onNewWindow.run()); MenuItem closeTabsMenuItem = new MenuItem("Class All Tabs"); closeTabsMenuItem.setOnAction(e -> onCloseAllTabs.run()); Menu winMenu = new Menu("_Window"); winMenu.getItems().add(newWinMenuItem); winMenu.getItems().add( closeTabsMenuItem); winMenu.setMnemonicParsing(true); getMenus().add(winMenu); }
Example 8
Source File: MyMenuBar.java From classpy with MIT License | 5 votes |
private void createHelpMenu() { MenuItem aboutMenuItem = new MenuItem("_About"); aboutMenuItem.setOnAction(e -> AboutDialog.showDialog()); aboutMenuItem.setMnemonicParsing(true); Menu helpMenu = new Menu("_Help"); helpMenu.getItems().add(aboutMenuItem); helpMenu.setMnemonicParsing(true); getMenus().add(helpMenu); }