Java Code Examples for javafx.scene.control.MenuItem#setAccelerator()
The following examples show how to use
javafx.scene.control.MenuItem#setAccelerator() .
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: AppContextMenu.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
@Inject AppContextMenu(WorkspaceMenu workspace, ModulesMenu modulesMenu) { MenuItem exit = new MenuItem(DefaultI18nContext.getInstance().i18n("E_xit")); exit.setOnAction(e -> Platform.exit()); exit.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN)); getItems().addAll(workspace, modulesMenu); if (!Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS_DEPRECATED) && !Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS)) { MenuItem settings = new MenuItem(DefaultI18nContext.getInstance().i18n("_Settings")); settings.setOnAction( e -> eventStudio().broadcast(new SetActiveDashboardItemRequest(PreferencesDashboardItem.ID))); getItems().add(settings); } getItems().addAll(new SeparatorMenuItem(), exit); }
Example 2
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 3
Source File: TermTreeView.java From erlyberly with GNU General Public License v3.0 | 6 votes |
public TermTreeView() { getStyleClass().add("term-tree"); setRoot(new TreeItem<TermTreeItem>()); MenuItem copyMenuItem = new MenuItem("Copy"); copyMenuItem.setAccelerator(KeyCombination.keyCombination("shortcut+c")); copyMenuItem.setOnAction(this::onCopyCalls); MenuItem dictMenuItem = new MenuItem("Dict to List"); dictMenuItem.setOnAction(this::onViewDict); MenuItem hexViewMenuItem = new MenuItem("Hex View"); hexViewMenuItem.setOnAction(this::onHexView); MenuItem decompileFunContextMenu = new MenuItem("Decompile Fun"); decompileFunContextMenu.setOnAction(this::onDecompileFun); setContextMenu(new ContextMenu(copyMenuItem, dictMenuItem, decompileFunContextMenu, hexViewMenuItem)); }
Example 4
Source File: SelectionTable.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
private void initTopSectionContextMenu(ContextMenu contextMenu, boolean hasRanges) { MenuItem setDestinationItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set destination"), MaterialDesignIcon.AIRPLANE_LANDING); setDestinationItem.setOnAction(e -> eventStudio().broadcast( requestDestination(getSelectionModel().getSelectedItem().descriptor().getFile(), getOwnerModule()), getOwnerModule())); setDestinationItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.ALT_DOWN)); selectionChangedConsumer = e -> setDestinationItem.setDisable(!e.isSingleSelection()); contextMenu.getItems().add(setDestinationItem); if (hasRanges) { MenuItem setPageRangesItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set as range for all"), MaterialDesignIcon.FORMAT_INDENT_INCREASE); setPageRangesItem.setOnAction(e -> eventStudio().broadcast( new SetPageRangesRequest(getSelectionModel().getSelectedItem().pageSelection.get()), getOwnerModule())); setPageRangesItem.setAccelerator(new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_DOWN)); selectionChangedConsumer = selectionChangedConsumer .andThen(e -> setPageRangesItem.setDisable(!e.isSingleSelection())); contextMenu.getItems().add(setPageRangesItem); } contextMenu.getItems().add(new SeparatorMenuItem()); }
Example 5
Source File: DatabaseMenu.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create the database menu. */ public DatabaseMenu() { super(LabelGrabber.INSTANCE.getLabel("database.heading")); newSongItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("new.song.button"), new ImageView(new Image(QueleaProperties.get().getUseDarkTheme() ? "file:icons/newsong-light.png" : "file:icons/newsong.png", 16, 16, false, true))); newSongItem.setOnAction(new NewSongActionHandler()); newSongItem.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN)); getItems().add(newSongItem); getItems().add(new SeparatorMenuItem()); importMenu = new ImportMenu(); getItems().add(importMenu); exportMenu = new ExportMenu(); getItems().add(exportMenu); }
Example 6
Source File: SelectionTable.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
private void initBottomSectionContextMenu(ContextMenu contextMenu) { MenuItem copyItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Copy to clipboard"), MaterialDesignIcon.CONTENT_COPY); copyItem.setOnAction(e -> copySelectedToClipboard()); MenuItem infoItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Document properties"), MaterialDesignIcon.INFORMATION_OUTLINE); infoItem.setOnAction(e -> Platform.runLater(() -> eventStudio() .broadcast(new ShowPdfDescriptorRequest(getSelectionModel().getSelectedItem().descriptor())))); MenuItem openFileItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open"), MaterialDesignIcon.FILE_PDF_BOX); openFileItem.setOnAction(e -> eventStudio() .broadcast(new OpenFileRequest(getSelectionModel().getSelectedItem().descriptor().getFile()))); MenuItem openFolderItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open Folder"), MaterialDesignIcon.FOLDER_OUTLINE); openFolderItem.setOnAction(e -> eventStudio().broadcast( new OpenFileRequest(getSelectionModel().getSelectedItem().descriptor().getFile().getParentFile()))); copyItem.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN)); infoItem.setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCombination.ALT_DOWN)); openFileItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN)); openFolderItem.setAccelerator( new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN, KeyCombination.ALT_DOWN)); contextMenu.getItems().addAll(new SeparatorMenuItem(), copyItem, infoItem, openFileItem, openFolderItem); selectionChangedConsumer = selectionChangedConsumer.andThen(e -> { copyItem.setDisable(e.isClearSelection()); infoItem.setDisable(!e.isSingleSelection()); openFileItem.setDisable(!e.isSingleSelection()); openFolderItem.setDisable(!e.isSingleSelection()); }); }
Example 7
Source File: PanelMenuCreator.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
public MenuItem closePanelMenuItem() { MenuItem closePanel = new MenuItem("Close"); closePanel.setOnAction(e -> { logger.info("Menu: Panels > Close"); panelControl.closeCurrentPanel(); }); closePanel.setAccelerator(CLOSE_PANEL); return closePanel; }
Example 8
Source File: Main.java From sis with Apache License 2.0 | 5 votes |
/** * Invoked by JavaFX for starting the application. * This method is called on the JavaFX Application Thread. * * @param window the primary stage onto which the application scene will be be set. */ @Override public void start(final Stage window) { this.window = window; final Vocabulary vocabulary = Vocabulary.getResources((Locale) null); /* * Configure the menu bar. For most menu item, the action is to invoke a method * of the same name in this application class (e.g. open()). */ final MenuBar menus = new MenuBar(); final Menu file = new Menu(vocabulary.getString(Vocabulary.Keys.File)); { final MenuItem open = new MenuItem(vocabulary.getMenuLabel(Vocabulary.Keys.Open)); open.setAccelerator(KeyCombination.keyCombination("Shortcut+O")); open.setOnAction(e -> open()); final MenuItem exit = new MenuItem(vocabulary.getString(Vocabulary.Keys.Exit)); exit.setOnAction(e -> Platform.exit()); file.getItems().addAll(open, new SeparatorMenuItem(), exit); } menus.getMenus().add(file); /* * Set the main content and show. */ content = new ResourceView(); final BorderPane pane = new BorderPane(); pane.setTop(menus); pane.setCenter(content.pane); Scene scene = new Scene(pane); window.setTitle("Apache Spatial Information System"); window.setScene(scene); window.setWidth(800); window.setHeight(650); window.show(); }
Example 9
Source File: PanelMenuCreator.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
public MenuItem createRightPanelMenuItem() { MenuItem createRight = new MenuItem("Create"); createRight.setOnAction(e -> { logger.info("Menu: Panels > Create"); panelControl.createNewPanelAtEnd(); // listener is used as panelsScroll's Hmax property doesn't update // synchronously ChangeListener<Number> listener = new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> arg0, Number arg1, Number arg2) { for (Node child : panelsScrollPane.getChildrenUnmodifiable()) { if (child instanceof ScrollBar) { ScrollBar scrollBar = (ScrollBar) child; if (scrollBar.getOrientation() == Orientation.HORIZONTAL && scrollBar.visibleProperty().get()) { panelControl.scrollToCurrentlySelectedPanel(); break; } } } panelControl.widthProperty().removeListener(this); } }; panelControl.widthProperty().addListener(listener); }); createRight.setAccelerator(CREATE_RIGHT_PANEL); return createRight; }
Example 10
Source File: TransferMenu.java From xframium-java with GNU General Public License v3.0 | 5 votes |
private MenuItem getMenuItem (String text, EventHandler<ActionEvent> eventHandler, KeyCode keyCode) { MenuItem menuItem = new MenuItem (text); menuItem.setOnAction (eventHandler); menuItem .setAccelerator (new KeyCodeCombination (keyCode, KeyCombination.SHORTCUT_DOWN)); return menuItem; }
Example 11
Source File: LogPane.java From pdfsam with GNU Affero General Public License v3.0 | 4 votes |
@Inject public LogPane(LogListView view) { this.logView = view; getStyleClass().addAll(Style.CONTAINER.css()); setCenter(this.logView); I18nContext i18n = DefaultI18nContext.getInstance(); MenuItem copyItem = new MenuItem(i18n.i18n("Copy")); copyItem.setId("copyLogMenuItem"); copyItem.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN)); copyItem.setOnAction(e -> copyLog(logView.getSelectionModel().getSelectedItems())); // disable if no selection copyItem.disableProperty().bind(new BooleanBinding() { { bind(logView.getSelectionModel().getSelectedIndices()); } @Override protected boolean computeValue() { return logView.getSelectionModel().getSelectedItems().isEmpty(); } }); MenuItem clearItem = new MenuItem(i18n.i18n("Clear")); clearItem.setId("clearLogMenuItem"); clearItem.setOnAction(e -> logView.getItems().clear()); // disable if there's no text clearItem.disableProperty().bind(new BooleanBinding() { { bind(logView.getItems()); } @Override protected boolean computeValue() { return logView.getItems().isEmpty(); } }); MenuItem selectAllItem = new MenuItem(i18n.i18n("Select all")); selectAllItem.setId("selectAllLogMenuItem"); selectAllItem.setOnAction(e -> logView.getSelectionModel().selectAll()); // disable if there's no text selectAllItem.disableProperty().bind(clearItem.disableProperty()); MenuItem saveItem = new MenuItem(i18n.i18n("Save log")); saveItem.setId("saveLogMenuItem"); saveItem.setOnAction(e -> saveLog()); // disable if there's no text saveItem.disableProperty().bind(clearItem.disableProperty()); SeparatorMenuItem separator = new SeparatorMenuItem(); logView.setContextMenu(new ContextMenu(copyItem, clearItem, selectAllItem, separator, saveItem)); logView.focusedProperty().addListener(o -> eventStudio().broadcast(new LogAreaVisiblityChangedEvent())); }
Example 12
Source File: ScheduleMenu.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create the scheudle menu */ public ScheduleMenu() { super(LabelGrabber.INSTANCE.getLabel("schedule.menu")); final MainPanel mainPanel = QueleaApp.get().getMainWindow().getMainPanel(); final ScheduleList scheduleList = mainPanel.getSchedulePanel().getScheduleList(); boolean darkTheme = QueleaProperties.get().getUseDarkTheme(); addPowerpointItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("add.presentation.button")); if (!Utils.isMac()) { addPowerpointItem.setGraphic(new ImageView(new Image(darkTheme ? "file:icons/powerpoint-light.png" : "file:icons/powerpoint.png", 20, 20, true, false))); } addPowerpointItem.setOnAction(new AddPowerpointActionHandler()); getItems().add(addPowerpointItem); addVideoItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("add.video.button")); if (!Utils.isMac()) { addVideoItem.setGraphic(new ImageView(new Image(darkTheme ? "file:icons/video file-light.png" : "file:icons/video file.png", 20, 20, true, false))); } addVideoItem.setOnAction(new AddVideoActionHandler()); getItems().add(addVideoItem); addTimerItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("add.timer.tooltip"), new ImageView(new Image(darkTheme ? "file:icons/timer-dark-light.png" : "file:icons/timer-dark.png", 16, 16, false, true))); addTimerItem.setOnAction(new AddTimerActionHandler()); getItems().add(addTimerItem); addPDFItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("add.pdf.tooltip"), new ImageView(new Image(darkTheme ? "file:icons/add_pdf-light.png" : "file:icons/add_pdf.png", 16, 16, false, true))); addPDFItem.setOnAction(new AddPdfActionHandler()); getItems().add(addPDFItem); dvdImageStack = new StackPane(); dvdImageStack.getChildren().add(new ImageView(new Image(darkTheme ? "file:icons/dvd-light.png" : "file:icons/dvd.png", 16, 16, false, true))); addDVDItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("add.dvd.button"), dvdImageStack); addDVDItem.setOnAction(new AddDVDActionHandler()); if (!Utils.isMac()) { getItems().add(addDVDItem); } addWebItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("add.website"), new ImageView(new Image(darkTheme ? "file:icons/web-small-light.png" : "file:icons/web-small.png", 16, 16, false, true))); addWebItem.setOnAction(new AddWebActionHandler()); getItems().add(addWebItem); addImageItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("add.images.panel"), new ImageView(new Image(darkTheme ? "file:icons/image-light.png" : "file:icons/image.png", 16, 16, false, true))); addImageItem.setOnAction(new AddImageActionHandler()); getItems().add(addImageItem); getItems().add(new SeparatorMenuItem()); manageNoticesItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("manage.notices.button"), new ImageView(new Image(darkTheme ? "file:icons/info-light.png" : "file:icons/info.png", 16, 16, false, true))); manageNoticesItem.setOnAction(new ShowNoticesActionHandler()); manageNoticesItem.setAccelerator(new KeyCodeCombination(KeyCode.M, KeyCombination.SHORTCUT_DOWN)); getItems().add(manageNoticesItem); exportScheduleItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("export.schedule.songs.pdf.button"), new ImageView(new Image(darkTheme ? "file:icons/pdf-light.png" : "file:icons/pdf.png", 16, 16, false, true))); exportScheduleItem.setOnAction(new ExportPDFScheduleSongsActionHandler()); getItems().add(exportScheduleItem); }
Example 13
Source File: MenuToolkit.java From NSMenuFX with BSD 3-Clause "New" or "Revised" License | 4 votes |
public MenuItem createCycleWindowsItem() { MenuItem menuItem = new MenuItem(labelMaker.getLabel(LabelName.CYCLE_THROUGH_WINDOWS)); menuItem.setAccelerator(new KeyCodeCombination(KeyCode.BACK_QUOTE, KeyCombination.META_DOWN)); menuItem.setOnAction(event -> StageUtils.focusNextStage()); return menuItem; }
Example 14
Source File: MenuToolkit.java From NSMenuFX with BSD 3-Clause "New" or "Revised" License | 4 votes |
public MenuItem createCloseWindowMenuItem() { MenuItem menuItem = new MenuItem(labelMaker.getLabel(LabelName.CLOSE_WINDOW)); menuItem.setAccelerator(new KeyCodeCombination(KeyCode.W, KeyCombination.META_DOWN)); menuItem.setOnAction(event -> StageUtils.closeCurrentStage()); return menuItem; }
Example 15
Source File: MenuToolkit.java From NSMenuFX with BSD 3-Clause "New" or "Revised" License | 4 votes |
public MenuItem createMinimizeMenuItem() { MenuItem menuItem = new MenuItem(labelMaker.getLabel(LabelName.MINIMIZE)); menuItem.setAccelerator(new KeyCodeCombination(KeyCode.M, KeyCombination.META_DOWN)); menuItem.setOnAction(event -> StageUtils.minimizeFocusedStage()); return menuItem; }
Example 16
Source File: MenuToolkit.java From NSMenuFX with BSD 3-Clause "New" or "Revised" License | 4 votes |
public MenuItem createHideOthersMenuItem() { MenuItem hideOthers = new MenuItem(labelMaker.getLabel(LabelName.HIDE_OTHERS)); hideOthers.setOnAction(event -> applicationAdapter.hideOtherApplications()); hideOthers.setAccelerator(new KeyCodeCombination(KeyCode.H, KeyCombination.META_DOWN, KeyCombination.ALT_DOWN)); return hideOthers; }
Example 17
Source File: MenuToolkit.java From NSMenuFX with BSD 3-Clause "New" or "Revised" License | 4 votes |
public MenuItem createQuitMenuItem(String appName) { MenuItem quit = new MenuItem(labelMaker.getLabel(LabelName.QUIT, appName)); quit.setOnAction(event -> applicationAdapter.quit()); quit.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCombination.META_DOWN)); return quit; }
Example 18
Source File: FontManagerType1.java From xframium-java with GNU General Public License v3.0 | 4 votes |
private Menu getMenu () { String fontSelected = getFontName (); String sizeSelected = "" + getFontSize (); Menu menuFont = new Menu ("Fonts"); // add font names List<String> families = Font.getFamilies (); for (String fontName : fontNames) { boolean fontExists = families.contains (fontName); if (fontExists && fontSelected.isEmpty ()) fontSelected = fontName; setMenuItem (menuFont, fontGroup, fontName, fontSelected, !fontExists); } // select Monospaced if there is still no font selected if (fontGroup.getSelectedToggle () == null) { ObservableList<Toggle> toggles = fontGroup.getToggles (); fontGroup.selectToggle (toggles.get (toggles.size () - 1)); } // add increase/decrease size commands menuFont.getItems ().add (new SeparatorMenuItem ()); MenuItem smaller = new MenuItem ("Smaller font"); smaller.setAccelerator (new KeyCodeCombination (KeyCode.MINUS, KeyCombination.SHORTCUT_DOWN)); smaller.setOnAction (e -> smaller ()); MenuItem bigger = new MenuItem ("Larger font"); bigger.setAccelerator (new KeyCodeCombination (KeyCode.PLUS, KeyCombination.SHORTCUT_DOWN)); bigger.setOnAction (e -> bigger ()); menuFont.getItems ().addAll (smaller, bigger, new SeparatorMenuItem ()); // add font sizes int count = 0; for (int fontSize : fontSizes) fontSizeItems[count++] = setMenuItem (menuFont, sizeGroup, fontSize + "", sizeSelected, false); return menuFont; }
Example 19
Source File: FileMenu.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create the file menu. */ public FileMenu() { super(LabelGrabber.INSTANCE.getLabel("file.menu")); boolean darkTheme = QueleaProperties.get().getUseDarkTheme(); newItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("new.schedule.button")); if (!Utils.isMac()) { newItem.setGraphic(getImage("file:icons/filenew.png")); } newItem.setOnAction(new NewScheduleActionHandler()); newItem.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN)); getItems().add(newItem); openItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("open.schedule.button")); if (!Utils.isMac()) { openItem.setGraphic(getImage("file:icons/fileopen.png")); } openItem.setOnAction(new OpenScheduleActionHandler()); openItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN)); getItems().add(openItem); saveItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("save.schedule.button")); if (!Utils.isMac()) { saveItem.setGraphic(getImage("file:icons/filesave.png")); } saveItem.setOnAction(new SaveScheduleActionHandler(false)); saveItem.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN)); getItems().add(saveItem); saveAsItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("save.as.schedule.button")); if (!Utils.isMac()) { saveAsItem.setGraphic(getImage("file:icons/filesaveas.png")); } saveAsItem.setOnAction(new SaveScheduleActionHandler(true)); getItems().add(saveAsItem); exportToPDFItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("export.schedule.pdf.button")); if(!Utils.isMac()) { exportToPDFItem.setGraphic(new ImageView(new Image("file:icons/fileexport.png", 20, 20, true, false))); } exportToPDFItem.setOnAction(new ExportPDFScheduleActionHandler()); getItems().add(exportToPDFItem); printItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("print.schedule.button")); if (!Utils.isMac()) { printItem.setGraphic(getImage("file:icons/fileprint.png")); } printItem.setOnAction(new PrintScheduleActionHandler()); printItem.setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN)); getItems().add(printItem); exitItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("exit.button")); if(!Utils.isMac()) { exitItem.setGraphic(new ImageView(new Image("file:icons/exit.png", 20, 20, true, false))); } exitItem.setOnAction(new ExitActionHandler()); getItems().add(exitItem); }
Example 20
Source File: ToolsMenu.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create the tools menu. */ public ToolsMenu() { super(LabelGrabber.INSTANCE.getLabel("tools.menu")); boolean darkTheme = QueleaProperties.get().getUseDarkTheme(); viewBibleItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("view.bible.button"), new ImageView(new Image(darkTheme ? "file:icons/bible-light.png" : "file:icons/bible.png", 20, 20, false, true))); viewBibleItem.setOnAction(new ViewBibleActionHandler()); getItems().add(viewBibleItem); searchBibleItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("search.bible.button"), new ImageView(new Image(darkTheme ? "file:icons/bible-light.png" : "file:icons/bible.png", 20, 20, false, true))); searchBibleItem.setOnAction(new SearchBibleActionHandler()); getItems().add(searchBibleItem); testItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("test.patterns.text"), new ImageView(new Image("file:icons/testbars.png", 20, 20, false, true))); testItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { TestPaneDialog dialog = testDialog.get(); if (dialog == null) { dialog = new TestPaneDialog(); testDialog = new SoftReference<>(dialog); } dialog.show(); } }); getItems().add(testItem); liveTextItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("send.live.text"), new ImageView(new Image(darkTheme ? "file:icons/live_text-light.png" : "file:icons/live_text.png", 20, 20, false, true))); liveTextItem.setAccelerator(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN)); liveTextItem.setOnAction(new LiveTextActionHandler()); if (QueleaApp.get().getMobileLyricsServer() == null) { liveTextItem.setDisable(true); } getItems().add(liveTextItem); optionsItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("options.button"), new ImageView(new Image("file:icons/options.png", 20, 20, false, true))); optionsItem.setAccelerator(new KeyCodeCombination(KeyCode.T, KeyCombination.SHORTCUT_DOWN)); optionsItem.setOnAction(new ShowOptionsActionHandler()); getItems().add(optionsItem); }