Java 类javafx.scene.control.MenuItem 实例源码

项目:Vokabeltrainer    文件:Main.java   
@Override
    public void start(Stage stage) {
        stage.setTitle("Vokabeltrainer");
        Scene scene = new Scene(new VBox(), 400, 350);
        scene.setFill(Color.OLDLACE);

        MenuBar menuBar = new MenuBar();

        // --- Menu File
        Menu menuFile = new Menu("Vokabeln");

        MenuItem sample = new MenuItem("Sample");
        sample.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
//              Do stuff here
            }
        });

        menuFile.getItems().add(sample);

        // --- Menu Edit
        Menu menuEdit = new Menu("Abfragemodus");

        // --- Menu View
        Menu menuView = new Menu("Statistik");

        menuBar.getMenus().addAll(menuFile, menuEdit, menuView);


        ((VBox) scene.getRoot()).getChildren().addAll(menuBar);

        stage.setScene(scene);
        stage.show();
    }
项目:Goliath-Overclocking-Utility-FX    文件:TabsMenu.java   
public TabsMenu(TabPane tabPane)
{
    super("Tabs");

    tabPaneToAddTo = tabPane;
    tabs = tabPane.getTabs().toArray(new Tab[tabPane.getTabs().size()]);

    handler = new MenuHandler(tabs);

    for(int i = 0; i < tabs.length; i++)
    {
        MenuItem tmp = new MenuItem(tabs[i].getText());
        tmp.setOnAction(handler);
        super.getItems().add(tmp);
    }
    tabPaneToAddTo.getTabs().remove(3, 5);
}
项目:cayenne-modeler    文件:ObjectEntityTreeItem.java   
@Override
public ContextMenu getContextMenu()
{
    ContextMenu contextMenu  = new ContextMenu();
    ObjEntity   objectEntity = (ObjEntity) getPropertyAdapter().getWrappedObject();

    getPropertyAdapter().getDataMapAdapter().getDatabaseEntityAdapters().stream().forEach(databaseEntity ->
        {
            if (StringUtils.equals(databaseEntity.getName(), objectEntity.getDbEntityName()))
            {
                MenuItem jumpTo = new MenuItem("Jump To Database Entity: " + databaseEntity.getName());

                jumpTo.setMnemonicParsing(false);
                jumpTo.setOnAction(event ->
                    {
                        LOGGER.debug("Jumping to DB Entity: " + databaseEntity.getName());
                    });

                contextMenu.getItems().add(jumpTo);
            }
        });

  return contextMenu;
}
项目:marathonv5    文件:TestRunner.java   
private MenuItem createMenuItem(JSONObject testJSON, boolean selectSave) {
    MenuItem item = new MenuItem(testJSON.getString("name") + " (" + testJSON.get("run-on") + ")");
    item.setOnAction((e) -> {
        errorMsgLabel.setVisible(false);
        errorMsgLabel.setText(null);
        Test test = createTest(testJSON);
        if (errorMsgLabel.getText() != null) {
            errorMsgLabel.setVisible(true);
        }
        console.clear();
        progressBar.reset(test.countTestCases());
        status.setText("Ready");
        TestTreeItem root = new TestTreeItem(test, this);
        testTree.setRoot(root);
        setState(root, testJSON);
        root.setExpanded(true);
        runReportDir = new File(reportDir, testJSON.getString("runReportDir"));
    });
    return item;
}
项目:vars-annotation    文件:AssocButtonFactory.java   
public Button build(String name, Association association) {

        EventBus eventBus = toolBox.getEventBus();

        Button button = new JFXButton(name);
        button.setUserData(association);
        button.getStyleClass().add("abpanel-button");
        button.setOnAction(event -> {
            ArrayList<Annotation> annotations = new ArrayList<>(toolBox.getData().getSelectedAnnotations());
            eventBus.send(new CreateAssociationsCmd(association, annotations));
        });
        button.setTooltip(new Tooltip(association.toString()));

        ContextMenu contextMenu = new ContextMenu();
        MenuItem deleteButton = new MenuItem(toolBox.getI18nBundle().getString("cbpanel.conceptbutton.delete"));
        deleteButton.setOnAction(event ->
                ((Pane) button.getParent()).getChildren().remove(button));
        contextMenu.getItems().addAll(deleteButton);
        button.setContextMenu(contextMenu);

        return button;

    }
项目:marathonv5    文件:ACEEditor.java   
private void createURLLink(String pattern, String id, String icon) {
    MenuItem tmsMenuItem = new MenuItem(id, FXUIUtils.getIcon(icon));
    if (pattern != null && pattern.length() > 0) {
        String url = String.format(pattern, id);
        tmsMenuItem.setOnAction((event) -> {
            try {
                Desktop.getDesktop().browse(new URI(url));
            } catch (IOException | URISyntaxException e) {
                e.printStackTrace();
            }
        });
    } else {
        tmsMenuItem.setDisable(true);
    }
    infoButton.getItems().add(tmsMenuItem);
}
项目:jmonkeybuilder    文件:SpatialTreeNode.java   
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree,
                            @NotNull final ObservableList<MenuItem> items) {
    if (!(nodeTree instanceof ModelNodeTree)) return;

    final T element = getElement();
    final AssetLinkNode linkNode = findParent(element, AssetLinkNode.class::isInstance);

    if (linkNode == null) {
        final Menu createMenu = createCreationMenu(nodeTree);
        if (createMenu != null) items.add(createMenu);
        final Menu toolMenu = createToolMenu(nodeTree);
        if (toolMenu != null) items.add(toolMenu);
    }

    if (linkNode == null || element == linkNode) {
        items.add(new AddUserDataAction(nodeTree, this));
    }

    if (canRemove()) {
        items.add(new RemoveNodeAction(nodeTree, this));
    }

    super.fillContextMenu(nodeTree, items);
}
项目:marathonv5    文件:RFXMenuItem.java   
private String getTagForMenu(MenuItem source) {
    LinkedList<MenuItem> menuItems = new LinkedList<>();
    while (source != null) {
        menuItems.addFirst(source);
        source = source.getParentMenu();
    }
    if (menuItems.getFirst() instanceof Menu) {
        if (menuItems.size() >= 2) {
            ownerNode = menuItems.get(1).getParentPopup().getOwnerNode();
            return isMenuBar(ownerNode) ? "#menu" : "#contextmenu";
        }
    } else {
        ownerNode = menuItems.getFirst().getParentPopup().getOwnerNode();
        return "#contextmenu";
    }
    return null;
}
项目:CalendarFX    文件:CalendarSelectorSkin.java   
private void updateMenuItems() {
    ToggleGroup group = new ToggleGroup();
    List<MenuItem> items = new ArrayList<>();
    for (Calendar calendar : getSkinnable().getCalendars()) {
        RadioMenuItem item = new RadioMenuItem(calendar.getName());
        Rectangle icon = new Rectangle(10, 10);
        icon.setArcHeight(2);
        icon.setArcWidth(2);
        icon.getStyleClass().add(calendar.getStyle() + "-icon"); //$NON-NLS-1$
        item.setGraphic(icon);
        item.setDisable(calendar.isReadOnly());
        item.setOnAction(evt -> getSkinnable().setCalendar(calendar));
        group.getToggles().add(item);
        items.add(item);
        if (calendar.equals(getSkinnable().getCalendar())) {
            item.setSelected(true);
        }
    }

    button.getItems().setAll(items);
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void subMenuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuEdit = new Menu("Edit");
        Menu menuEffect = new Menu("Picture Effect");

        final MenuItem noEffects = new MenuItem("No Effects");

        menuEdit.getItems().addAll(menuEffect, noEffects);
        MenuItem add = new MenuItem("Shuffle");
        menuEffect.getItems().addAll(add);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(add));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("Edit>>Picture Effect>>Shuffle", path.get(0));
}
项目:HotaruFX    文件:EditorController.java   
private void populateExamples() {
    val map = new LinkedHashMap<String, String>();
    map.put("HotaruFX Logo", "hotarufx-logo.hfx");
    map.put("Font Awesome Icons", "font-awesome.hfx");
    map.put("HSV Color", "hsv.hfx");
    map.put("Line", "line.hfx");
    map.put("Rectangle", "rectangle.hfx");
    map.put("Round Rectangle", "round-rect.hfx");
    map.put("Font", "font.hfx");
    map.put("Image", "image.hfx");
    map.put("Image Rotate & Zoom", "image_rotate_zoom.hfx");
    map.put("Text Clipping", "clip-text.hfx");
    map.put("Blend Modes", "blend-modes.hfx");
    map.put("Stroke Ants", "stroke-ants.hfx");
    examplesMenu.getItems().clear();
    for (val entry : map.entrySet()) {
        val item = new MenuItem(entry.getKey());
        item.setOnAction(e -> openExample("/examples/" + entry.getValue()));
        examplesMenu.getItems().add(item);
    }
}
项目:BatpackJava    文件:batteryMonitorLayoutController.java   
private void buildMenuItem() {
    for (int i = 0; i < this.batpack.getModuleCount(); i++) {
        Group module = batteryModules.get(i);
        String labelText = ((Label) module.getChildren().get(3)).getText();
        MenuItem menuItem = new MenuItem(labelText);
        menuItem.setId(Integer.toString(i));
        EventHandler<ActionEvent> updateCells;
        updateCells = (event) -> {
            MenuItem menu = (MenuItem) event.getSource();
            int id = Integer.parseInt(menu.getId());
            moduleChooser.setText("module " + (id + 1));
            updateCells(id);
        };
        menuItem.setOnAction(updateCells);
        List<MenuItem> menuItems = new ArrayList<>();
        menuItems.add(menuItem);
        moduleChooser.getItems().addAll(menuItems);
    }
}
项目:ClassViewer    文件:TextPaneMenu.java   
public TextPaneMenu(TextArea textArea) {
    this.textArea = textArea;
    MenuItem copy = new MenuItem("_Copy");
    this.setStyle(FontUtils.setUIFont(this.getStyle()));
    copy.setMnemonicParsing(true);
    copy.setOnAction(e -> {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

        StringSelection s = new StringSelection(
                textArea.getSelectedText()
        );

        clipboard.setContents(s, null);
    });
    copy.setGraphic(new ImageView(ImageUtils.copyImage));

    getItems().addAll(copy);
}
项目:ClassViewer    文件:AsciiPaneMenu.java   
public AsciiPaneMenu(TextArea textArea) {
    this.textArea = textArea;
    MenuItem copy = new MenuItem("_Copy");
    this.setStyle(FontUtils.setUIFont(this.getStyle()));
    copy.setMnemonicParsing(true);
    copy.setOnAction(e -> {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

        StringSelection s = new StringSelection(
                textArea.getSelectedText().replace("\n", "")
        );

        clipboard.setContents(s, null);
    });
    copy.setGraphic(new ImageView(ImageUtils.copyImage));

    getItems().addAll(copy);
}
项目:Cognizant-Intelligent-Test-Scripter    文件:HelpBrowser.java   
@Override
public void load() {
    super.load();
    Platform.runLater(new Runnable() { // this will run initFX as JavaFX-Thread
        @Override
        public void run() {
            webView.setContextMenuEnabled(false);
            contextMenu = new ContextMenu();
            open = new MenuItem("Open in browser");
            addActionListener();
            addContextMenuListener();
            contextMenu.getItems().addAll(open);
        }
    });

}
项目:Goliath-Overclocking-Utility-FX    文件:ThemesMenu.java   
@Override
public void handle(ActionEvent event)
{   
    GoliathOUFX.scene.getStylesheets().remove(0);

    switch(((MenuItem)event.getSource()).getText())
    {
        case "Magma":
            GoliathOUFX.scene.getStylesheets().add("skins/Goliath-Magma.css");
            break;

        case "Arc":
            GoliathOUFX.scene.getStylesheets().add("skins/Goliath-Arc.css");
            break;   
    }
}
项目:jmonkeybuilder    文件:VehicleControlTreeNode.java   
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree,
                            @NotNull final ObservableList<MenuItem> items) {

    items.add(new CreateVehicleWheelAction(nodeTree, this));

    super.fillContextMenu(nodeTree, items);
}
项目:shuffleboard    文件:ActionList.java   
/**
 * Add an action with an associated graphic, such as a checkmark or icon.
 */
public ActionList addAction(String name, Node graphic, Runnable r) {
  actions.add(() -> {
    MenuItem item = FxUtils.menuItem(name, _e -> r.run());
    item.setGraphic(graphic);
    return item;
  });
  return this;
}
项目:jmonkeybuilder    文件:SceneNodeTreeNode.java   
@Override
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {
    if (!(nodeTree instanceof ModelNodeTree)) return;

    final Menu createMenu = createCreationMenu(nodeTree);

    items.add(createMenu);
    items.add(new RenameNodeAction(nodeTree, this));
}
项目:WebPLP    文件:PLPToolMenuBarPanel.java   
private Menu createViewMenu()
{
    Menu viewMenu = new Menu("View");

    MenuItem itemClearOutput = new MenuItem("Clear Output Pane");
    itemClearOutput.setAccelerator(new KeyCodeCombination(KeyCode.D,
            KeyCombination.CONTROL_DOWN));
    itemClearOutput.setOnAction((e) -> controller.clearConsole());

    viewMenu.getItems().addAll(itemClearOutput);
    return viewMenu;
}
项目:titanium    文件:MainPane.java   
private Menu getHelpMenu() {
    Menu result = new Menu("Help");
    MenuItem aboutItem = new MenuItem("About Titanium");

    result.getItems().addAll(aboutItem);

    return result;
}
项目:jmonkeybuilder    文件:VehicleWheelTreeNode.java   
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree,
                            @NotNull final ObservableList<MenuItem> items) {
    super.fillContextMenu(nodeTree, items);
    items.add(new RemoveVehicleWheelAction(nodeTree, this));
}
项目:jmonkeybuilder    文件:SceneLayerTreeNode.java   
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {
    super.fillContextMenu(nodeTree, items);

    final SceneLayer layer = getElement();

    if (!layer.isBuiltIn()) {
        items.add(new RenameNodeAction(nodeTree, this));
        items.add(new RemoveSceneLayerAction(nodeTree, this));
    }
}
项目:JavaFX-EX    文件:RecentFileMenuSupport.java   
public File getLastFile() {
  if (recents.size() == 0) {
    return new File(".");
  } else {
    Pair<File, MenuItem> pair = recents.remove(recents.size() - 1);
    File file = pair.getKey();
    if (Files.exists(file.toPath())) {
      return file;
    } else {
      recents.remove(pair);
      return getLastFile();
    }
  }
}
项目:tenhou-visualizer    文件:InfoSchemaTableRow.java   
@Override
protected void updateItem(InfoSchema item, boolean empty) {
    super.updateItem(item, empty);
    if (empty) {
        this.setContextMenu(null);
    } else {
        ContextMenu contextMenu = new ContextMenu();
        if (!this.service.isDownloaded(item)) {
            MenuItem downloadMjlog = new MenuItem("牌譜をデータベースに追加する");
            downloadMjlog.setOnAction(e -> this.controller.downloadMjlog(null));
            contextMenu.getItems().add(downloadMjlog);
        } else {
            MenuItem removeMjlog = new MenuItem("牌譜をデータベースから削除する");
            removeMjlog.setOnAction(e -> this.controller.removeMjlog(null));
            contextMenu.getItems().add(removeMjlog);
        }
        contextMenu.getItems().add(new SeparatorMenuItem());
        MenuItem filterWithFirst = new MenuItem("「" + item.getFirst() + "」で検索");
        filterWithFirst.setOnAction(e -> updateFilter(item.getFirst()));
        MenuItem filterWithSecond = new MenuItem("「 " + item.getSecond() + "」で検索");
        filterWithSecond.setOnAction(e -> updateFilter(item.getSecond()));
        MenuItem filterWithThird = new MenuItem("「 " + item.getThird() + "」で検索");
        filterWithThird.setOnAction(e -> updateFilter(item.getThird()));
        contextMenu.getItems().addAll(filterWithFirst, filterWithSecond, filterWithThird);
        if (item.getFourth() != null) {
            MenuItem filterWithFourth = new MenuItem("「 " + item.getFourth() + "」で検索");
            filterWithFourth.setOnAction(e -> updateFilter(item.getFourth()));
            contextMenu.getItems().add(filterWithFourth);
        }
        this.setContextMenu(contextMenu);
    }
}
项目:Squid    文件:SpotManagerController.java   
private ContextMenu createRefMatSpotsViewContextMenu() {
    ContextMenu contextMenu = new ContextMenu();
    MenuItem menuItem = new MenuItem("Clear list.");
    menuItem.setOnAction((evt) -> {
        squidProject.updateFilterForRefMatSpotNames("");
        updateReferenceMaterialsList(true);
    });
    contextMenu.getItems().add(menuItem);
    return contextMenu;
}
项目:LIRE-Lab    文件:MenuBarController.java   
private void setupFileMenu() {
    List<Command<Void>> commands = applicationCommands.getFileMenuCommands();
    for (Command<Void> command : commands) {
        MenuItem menuItem = commandTriggerFactory.createMenuItem(command, () -> null);
        menuItem.setId(command.getNodeId());
        fileMenu.getItems().add(menuItem);
    }
}
项目:Squid    文件:SquidUIController.java   
private void buildTaskLibraryMenu() {
    selectSquid3TaskFromLibraryMenu.setDisable(false);

    selectSquid3TaskFromLibraryMenu.getItems().clear();
    Map< String, TaskInterface> taskLibrary = squidProject.getTaskLibrary();
    for (Map.Entry< String, TaskInterface> entry : taskLibrary.entrySet()) {
        MenuItem menuItem = new MenuItem(entry.getKey());
        menuItem.setOnAction((ActionEvent t) -> {
            // get a new library
            squidProject.loadAndInitializeLibraryTask(squidProject.getTaskLibrary().get(menuItem.getText()));
            launchTaskManager();
        });
        selectSquid3TaskFromLibraryMenu.getItems().add(menuItem);
    }
}
项目:shuffleboard    文件:WidgetPaneController.java   
private void createPaneContextMenu(ContextMenuEvent e) {
  MenuItem clear = FxUtils.menuItem("Clear", __ -> {
    List<Tile> tiles = new ArrayList<>(pane.getTiles());
    tiles.stream()
        .map((Function<Tile, Component>) pane::removeTile)
        .flatMap(Component::allComponents)
        .flatMap(TypeUtils.castStream(Sourced.class))
        .forEach(Sourced::removeAllSources);
  });
  ContextMenu contextMenu = new ContextMenu(clear);
  contextMenu.show(pane.getScene().getWindow(), e.getScreenX(), e.getScreenY());
}
项目:bubuirc    文件:TreeContextMenuPane.java   
public ContextMenu getDefaultMenu() {
    ContextMenu menu = new ContextMenu();
    List<MenuItem> items = new ArrayList<>();
    items.add(addChannel);
    menu.getItems().addAll(items);
    return menu;
}
项目:stvs    文件:TimingDiagramController.java   
/**
 * Create mouse events and context menu entries.
 */
private void initCommon() {
  view.setDurations(concreteSpec.getDurations());
  // view.getyAxis().layoutBoundsProperty().addListener(change -> updateAxisExternalPosition());
  view.setOnMouseClicked(this::onMouseClicked);
  MenuItem xpositiveZoomItem = new MenuItem("Zoom X+");
  xpositiveZoomItem.setOnAction(this::onXPositiveZoom);
  MenuItem xnegativeZoomItem = new MenuItem("Zoom X-");
  xnegativeZoomItem.setOnAction(this::onXNegativeZoom);
  view.getContextMenu().getItems().setAll(xpositiveZoomItem, xnegativeZoomItem);
  ObservableList<Rectangle> cycleSelectionRectangles = view.getCycleSelectionRectangles();
  for (int i = 0; i < cycleSelectionRectangles.size(); i++) {
    Rectangle cycleSelectionRectangle = cycleSelectionRectangles.get(i);
    int finalCycleIndex = i;
    cycleSelectionRectangle.setOnMouseEntered(event -> {
      if (activated.get()) {
        cycleSelectionRectangle.setOpacity(1);
        selection.setRow(concreteSpec.cycleToRowNumber(finalCycleIndex));
        selection.setColumn(ioVariable.getName());
      }
    });
    cycleSelectionRectangle.setOnMouseExited(event -> {
      if (activated.get()) {
        cycleSelectionRectangle.setOpacity(0);
        selection.clear();
      }
    });
    cycleSelectionRectangle.setOnMouseClicked(event -> {
      if (event.getButton() == MouseButton.PRIMARY) {
        selection.fireClickEvent(ioVariable.getName(),
            concreteSpec.cycleToRowNumber(finalCycleIndex));
      }
    });
  }
}
项目:fx-media-tags    文件:FxMediaTags.java   
private MenuItem createMenuDelete() {
    final MenuItem menuDelete = new MenuItem("Delete");
    menuDelete.setOnAction(event -> {
        final MetaTagModel metaTagModel = TAGS_TABLE.getSelectionModel().getSelectedItem();
        if (null != metaTagModel) {
            if (null != MODEL.getOnDeleteTag()) {
                MODEL.getOnDeleteTag().accept(metaTagModel);
            }
            MODEL.tagsProperty().remove(metaTagModel);
        }
    });
    return menuDelete;
}
项目:CalendarFX    文件:AgendaView.java   
private ContextMenu buildContextMenu() {
    ContextMenu menu = new ContextMenu();
    Menu lookBackMenu = new Menu(Messages.getString("AgendaView.MENU_ITEM_LOOK_BACK")); //$NON-NLS-1$
    Menu lookAheadMenu = new Menu(Messages.getString("AgendaView.MENU_ITEM_LOOK_AHEAD")); //$NON-NLS-1$

    String format = Messages.getString("AgendaView.MENU_ITEM_DAYS"); //$NON-NLS-1$

    MenuItem lookBack0 = new MenuItem(MessageFormat.format(format, 0));
    MenuItem lookBack10 = new MenuItem(MessageFormat.format(format, 10));
    MenuItem lookBack20 = new MenuItem(MessageFormat.format(format, 20));
    MenuItem lookBack30 = new MenuItem(MessageFormat.format(format, 30));
    MenuItem lookAhead0 = new MenuItem(MessageFormat.format(format, 0));
    MenuItem lookAhead10 = new MenuItem(MessageFormat.format(format, 10));
    MenuItem lookAhead20 = new MenuItem(MessageFormat.format(format, 20));
    MenuItem lookAhead30 = new MenuItem(MessageFormat.format(format, 30));
    lookBackMenu.getItems().addAll(lookBack0, lookBack10, lookBack20, lookBack30);
    lookAheadMenu.getItems().addAll(lookAhead0, lookAhead10, lookAhead20, lookAhead30);
    menu.getItems().addAll(lookBackMenu, lookAheadMenu);

    lookBack0.setOnAction(evt -> setLookBackPeriodInDays(0));
    lookBack10.setOnAction(evt -> setLookBackPeriodInDays(10));
    lookBack20.setOnAction(evt -> setLookBackPeriodInDays(20));
    lookBack30.setOnAction(evt -> setLookBackPeriodInDays(30));

    lookAhead0.setOnAction(evt -> setLookAheadPeriodInDays(0));
    lookAhead10.setOnAction(evt -> setLookAheadPeriodInDays(10));
    lookAhead20.setOnAction(evt -> setLookAheadPeriodInDays(20));
    lookAhead30.setOnAction(evt -> setLookAheadPeriodInDays(30));

    return menu;
}
项目:fx-media-tags    文件:FxMediaTags.java   
private ContextMenu createContextMenu() {
    final ContextMenu contextMenu = new ContextMenu();
    final ObservableList<MenuItem> menuItems = contextMenu.getItems();
    menuItems.add(createMenuAdd());
    menuItems.add(createMenuDelete());
    menuItems.add(createMenuRename());
    menuItems.add(new SeparatorMenuItem());
    menuItems.add(new MenuItem("Cancel"));
    return contextMenu;
}
项目:JavaFX-EX    文件:RecentFileMenuSupport.java   
public void setLastFile(File file) {
  if (file == null) {
    return;
  }
  List<Pair<File, MenuItem>> collect = recents.stream().filter(p -> p.getKey().equals(file))
      .collect(Collectors.toList());
  recents.removeAll(collect);
  recents.add(getRecentMenuItemPair(file));
}
项目:stvs    文件:SpecificationsPaneController.java   
private ContextMenu createTabContextMenu() {
  ContextMenu contextMenu = new ContextMenu();
  MenuItem setNameItem = new MenuItem("Rename");
  setNameItem.setOnAction(this::onTabSetName);
  contextMenu.getItems().add(setNameItem);
  return contextMenu;
}
项目:marathonv5    文件:ProjectSelection.java   
private List<MenuItem> getAvailableFrameworks() {
    List<MenuItem> items = new ArrayList<>();
    for (List<String> framework : frameworks) {
        items.add(getFrameworkMenuItem(framework.get(0), framework.get(1)));
    }
    return items;
}
项目:marathonv5    文件:ProjectSelection.java   
public MenuItem getFrameworkMenuItem(String name, final String framework) {
    MenuItem projectMenuItem = new MenuItem(name);
    projectMenuItem.addEventHandler(ActionEvent.ACTION, (e) -> {
        System.setProperty(Constants.PROP_PROJECT_FRAMEWORK, framework);
        onNew();
    });
    return projectMenuItem;
}
项目:marathonv5    文件:FolderResource.java   
@Override public MenuItem[] getUnhideMenuItem() {
    return hiddenFiles.stream().map((file) -> {
        MenuItem menuItem = new MenuItem(file, new ImageView());
        menuItem.setOnAction((event) -> hiddenFiles.remove(file));
        return menuItem;
    }).collect(Collectors.toList()).toArray(new MenuItem[hiddenFiles.size()]);
}
项目:jfreechart-fx    文件:ChartViewer.java   
/**
 * Creates the context menu.
 * 
 * @return The context menu.
 */
private ContextMenu createContextMenu() {
    final ContextMenu menu = new ContextMenu();
    menu.setAutoHide(true);
    Menu export = new Menu("Export As");

    MenuItem pngItem = new MenuItem("PNG...");
    pngItem.setOnAction(e -> handleExportToPNG());        
    export.getItems().add(pngItem);

    MenuItem jpegItem = new MenuItem("JPEG...");
    jpegItem.setOnAction(e -> handleExportToJPEG());        
    export.getItems().add(jpegItem);

    if (ExportUtils.isOrsonPDFAvailable()) {
        MenuItem pdfItem = new MenuItem("PDF...");
        pdfItem.setOnAction(e -> handleExportToPDF());
        export.getItems().add(pdfItem);
    }
    if (ExportUtils.isJFreeSVGAvailable()) {
        MenuItem svgItem = new MenuItem("SVG...");
        svgItem.setOnAction(e -> handleExportToSVG());
        export.getItems().add(svgItem);        
    }
    menu.getItems().add(export);
    return menu;
}