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

项目:marathonv5    文件:JavaFXMenuBarElement.java   
@Override public boolean marathon_select(String value) {
    MenuBar menuBar = (MenuBar) node;
    ObservableList<Menu> menus = menuBar.getMenus();
    String[] items = value.split("\\>\\>");
    Menu parentMenu = getParentMenu(menus, items[0]);
    List<MenuItem> menuItems = new ArrayList<>();
    for (int i = 1; i < items.length; i++) {
        getChidernMenuItem(parentMenu, items[i], menuItems);
    }
    parentMenu.fire();
    menuItems.stream().forEach((menu) -> {
        if (menu instanceof CheckMenuItem) {
            CheckMenuItem checkMenuItem = (CheckMenuItem) menu;
            checkMenuItem.setSelected(!checkMenuItem.isSelected());
        } else if (menu instanceof RadioMenuItem) {
            RadioMenuItem radioMenuItem = (RadioMenuItem) menu;
            radioMenuItem.setSelected(!isSelected());
        }
        menu.fire();
    });
    return true;
}
项目:marathonv5    文件:JavaFXContextMenuElement.java   
@Override public boolean marathon_select(String value) {
    String[] items = value.split("\\>\\>");
    ObservableList<MenuItem> children = contextMenu.getItems();
    List<MenuItem> menuItems = new ArrayList<>();
    for (String item : items) {
        getChidernMenuItem(children, item, menuItems);
    }
    menuItems.stream().forEach((menu) -> {
        if (menu instanceof CheckMenuItem) {
            CheckMenuItem checkMenuItem = (CheckMenuItem) menu;
            checkMenuItem.setSelected(!checkMenuItem.isSelected());
        } else if (menu instanceof RadioMenuItem) {
            RadioMenuItem radioMenuItem = (RadioMenuItem) menu;
            radioMenuItem.setSelected(!isSelected());
        }
        menu.fire();
    });
    contextMenu.hide();
    return true;
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void specialChars() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuView = new Menu("View");
        CheckMenuItem titleView = createMenuItem("Tit>le");
        CheckMenuItem binNameView = createMenuItem("Binomial name");
        CheckMenuItem picView = createMenuItem("Picture");
        CheckMenuItem descriptionView = createMenuItem("Decsription");

        menuView.getItems().addAll(titleView, binNameView, picView, descriptionView);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(titleView));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("View>>Tit\\>le", path.get(0));
}
项目:Projeto-IP2    文件:EventosCadastroProfessorController.java   
public void confirma() {
    ConfirmaBotao.setOnMouseClicked(e -> {
        Professor prof = new Professor(nomeP.getText(), login.getText(), senha.getText());
        for(int i = 0; i < disponiveis.getItems().size(); i++ ) {
            temp = (CheckMenuItem) disponiveis.getItems().get(i);
            if(temp.isSelected()==true) {
                prof.addDisciplinasPossiveis(DisciplinaController.getInstance().procurarNomeDisciplina(temp.getText()));            
            }
        }
        try {
            ProfessorController.getInstance().cadastraProf(prof);
        } catch (ProfessorJaExisteException e1) {

            e1.printStackTrace();
        }

        //Stage stage = (Stage) ConfirmaBotao.getScene().getWindow();
        //stage.close();
        ScreenManager.getInstance().setaProfessorCenterNull();
    });
}
项目:Projeto-IP2    文件:RemoverDisciplina.java   
public void adiciona() {
    List<CheckMenuItem> me = new ArrayList<>();
    if(DisciplinaController.getInstance().retornaListaDisciplina()!=null) { 
        lista = DisciplinaController.getInstance().retornaListaDisciplina();
        for(int i = 0; i < this.lista.size(); i++) {
            me.add(new CheckMenuItem(this.lista.get(i).getNome()));
            final int x = i;
            me.get(i).setOnAction(e -> {
                if(me.get(x).isSelected()) {
                    for(int z = 0; z < me.size(); z++) {
                        if(!me.get(z).equals(me.get(x))) {
                            me.get(z).setSelected(false);
                        }
                    }
                }
                id.setText(me.get(x).getText());
                nome.setText(String.valueOf(lista.get(x).getId()));
            });
        }
    }
    CheckMenuItem[] array = me.toArray(new CheckMenuItem[me.size()]);
    menu2.getItems().addAll(array);
}
项目:Projeto-IP2    文件:AtualizarDisciplina.java   
public void adiciona() {
    List<CheckMenuItem> me = new ArrayList<>();
    if(DisciplinaController.getInstance().retornaListaDisciplina()!=null) { 
        lista = DisciplinaController.getInstance().retornaListaDisciplina();
        for(int i = 0; i < this.lista.size(); i++) {
            me.add(new CheckMenuItem(this.lista.get(i).getNome()));
            final int x = i;
            me.get(i).setOnAction(e -> {
                if(me.get(x).isSelected()) {
                    for(int z = 0; z < me.size(); z++) {
                        if(!me.get(z).equals(me.get(x))) {
                            me.get(z).setSelected(false);
                        }
                    }
                }
                nome.setText(me.get(x).getText());
                id.setText(String.valueOf(lista.get(x).getId()));
            });
        }
    }
    CheckMenuItem[] array = me.toArray(new CheckMenuItem[me.size()]);
    menu2.getItems().addAll(array);
}
项目:Projeto-IP2    文件:ProcurarDisciplina.java   
public void adiciona() {
    List<CheckMenuItem> me = new ArrayList<>();
    if(DisciplinaController.getInstance().retornaListaDisciplina()!=null) { 
        lista = DisciplinaController.getInstance().retornaListaDisciplina();
        for(int i = 0; i < this.lista.size(); i++) {
            me.add(new CheckMenuItem(this.lista.get(i).getNome()));
            final int x = i;
            me.get(i).setOnAction(e -> {
                if(me.get(x).isSelected()) {
                    for(int z = 0; z < me.size(); z++) {
                        if(!me.get(z).equals(me.get(x))) {
                            me.get(z).setSelected(false);
                        }
                    }
                }
                dois.setText(me.get(x).getText());
                um.setText(String.valueOf(lista.get(x).getId()));
            });
        }
    }
    CheckMenuItem[] array = me.toArray(new CheckMenuItem[me.size()]);
    menu2.getItems().addAll(array);
}
项目:openjfx-8u-dev-tests    文件:MenuItemApp.java   
public InvisibleItemsMenu() {
    super(INVISIBLE_ID);
    setId(INVISIBLE_ID);

    getItems().addAll(
            new MenuItem("Menu Item", new Rectangle(10, 10)),
            new MenuItem("Invisible Menu Item", new Rectangle(10, 10)),
            new CheckMenuItem("Check Item", new Rectangle(10, 10)),
            new CheckMenuItem("Invisible Check Item", new Rectangle(10, 10)),
            new RadioMenuItem("Radio Item", new Rectangle(10, 10)),
            new RadioMenuItem("Invisible Radio Item", new Rectangle(10, 10)),
            new CustomMenuItem(new Label("Custom Item")),
            new CustomMenuItem(new Label("Invisible Custom Item")));

    setEventHandlers();
}
项目:openjfx-8u-dev-tests    文件:MenuItemParent.java   
@Override
public <T> Wrap<? extends T> wrap(Class<T> controlClass, T control) {
    if (MenuItem.class.isInstance(control)) {
        if (Menu.class.isInstance(control)) {
            return (Wrap<? extends T>)
                    new MenuWrap<>(wrap.getEnvironment(), Menu.class.cast(control));
        } else if (RadioMenuItem.class.isInstance(control)) {
            return (Wrap<? extends T>)
                    new RadioMenuItemWrap<>(wrap.getEnvironment(), RadioMenuItem.class.cast(control));
        } else if (CheckMenuItem.class.isInstance(control)) {
            return (Wrap<? extends T>)
                    new CheckMenuItemWrap<>(wrap.getEnvironment(), CheckMenuItem.class.cast(control));
        } else {
            return (Wrap<? extends T>) new MenuItemWrap(wrap.getEnvironment(), MenuItem.class.cast(control));
        }
    }
    throw new JemmyException("Unexpected control class is used: " + controlClass);
}
项目:Simulizer    文件:MainMenuBar.java   
/**
 * Dynamically generates the windows menu items
 *
 * @param windowsMenu
 *            The windows menu to add the items to
 */
private void windowsMenuHelper(Menu windowsMenu) {
    windowsMenu.getItems().clear();
    for (WindowEnum wenum : WindowEnum.values()) {
        if (wenum.showInWindowsMenu()) {
            CheckMenuItem item = new CheckMenuItem(wenum.toString());
            item.setSelected(wm.getWorkspace().windowIsOpen(wenum));
            item.setOnAction(e -> {
                InternalWindow window = wm.getWorkspace().findInternalWindow(wenum);
                if (window == null)
                    wm.getWorkspace().openInternalWindow(wenum);
                else
                    window.close();
            });
            windowsMenu.getItems().add(item);
        }
    }

    MenuItem delWindows = new MenuItem("Close All");
    delWindows.setOnAction(e -> wm.getWorkspace().closeAll());
    windowsMenu.getItems().addAll(new SeparatorMenuItem(), delWindows);
}
项目:Gamma-Music-Manager    文件:MenuUI.java   
/**
 * Function to create the search submenu for the top.
 *
 * @param filePersistentStorage The file storage to retrieve the state.
 * @return                      The search submenu options.
 */
private Menu createSearchSubmenu(FilePersistentStorage filePersistentStorage) {
    Menu searchSubMenu = new Menu(SEARCH_HEADER);
    CheckMenuItem showFilesInFolderHits = new CheckMenuItem(SHOW_FILES_IN_FOLDER_HITS_HEADER);
    showFilesInFolderHits.setSelected(filePersistentStorage.getShowFilesInFolderHit());

    showFilesInFolderHits.setOnAction(event -> {
        if (showFilesInFolderHits.isSelected()) {
            m_model.getM_menuOptions().setShowFilesInFolderSearchHit(true);
        } else {
            m_model.getM_menuOptions().setShowFilesInFolderSearchHit(false);
        }
        m_model.notifySearchObservers();
    });

    searchSubMenu.getItems().add(showFilesInFolderHits);

    return searchSubMenu;
}
项目:3DScanner.RaspberryPi    文件:UIController.java   
/**
 * Hacky solution for the quality selector, which makes it sure only one quality can be selectet at
 * a time. The selected quality is stored as a String in the global variable qualitySelected for a still
 * unsure purpose 
 * @param e
 */
@FXML
private void hadleDauerSelect(ActionEvent e){
    Object source = e.getSource();
    dselectedMenuItem = (CheckMenuItem) source;
    high.setSelected(false);
    medium.setSelected(false);
    low.setSelected(false);
    dselectedMenuItem.setSelected(true);
    dauerSelected = dselectedMenuItem.getId();
    switch (dauerSelected.toLowerCase().charAt(0)){
        case 'l': beleuchtungsDauer = 0;
        System.out.println("hello777");
        break;
        case 'm': beleuchtungsDauer = 1;
        System.out.println("hello123");
        break;
        case 'h': beleuchtungsDauer = 2;
        break;
    }
    System.out.println(beleuchtungsDauer);
    dauerChoose.setText("Beleuchtung: "+ dselectedMenuItem.getText());
    //System.out.println(qualitySelected + " Qualität Selektiert"); 
    // Btw \u00E4 das ist ein kleines ä in unicode http://www.bennyn.de/programmierung/java/umlaute-und-sonderzeichen-in-java.html
}
项目:WhoWhatWhere    文件:SettingsManager.java   
public EventHandler<ActionEvent> handleStartWithWindowsClick(boolean allUsers, CheckMenuItem otherItem)
{
    return ae ->
    {
        boolean add = ((CheckMenuItem) ae.getSource()).isSelected();

        try
        {
            StartWithWindowsRegistryUtils.setRegistryToStartWithWindows(add, allUsers);
        }
        catch (IOException ioe)
        {
            logger.log(Level.SEVERE, "Unable to modify the registry for the \"start with Windows\" setting", ioe);
            new Alert(AlertType.ERROR, "Unable to modify the registry for the \"start with Windows\" setting").showAndWait();
            return;
        }

        otherItem.setSelected(false); //if one is selected, the other one has to be unselected. if the click is to de-select, the other one was already unselected as well anyway.

        Alert success = new Alert(AlertType.INFORMATION, Main.appTitle + (add ? " is now set to " : " will not ") + "start with Windows for " + (allUsers ? "all users" : "this user"));
        success.setTitle("Start with Windows");
        success.setHeaderText("Setting changed");
        success.showAndWait();
    };
}
项目:Cachoeira    文件:ResourceContextMenu.java   
private void refreshTaskMenu(ObservableList<MenuItem> menuItemList,
                             IResource currentRowResource,
                             ObservableList<ITask> taskList) {
    menuItemList.clear();
    for (ITask task : taskList) {
        CheckMenuItem checkMenuItem = new CheckMenuItem(task.getName());
        task.getResourceList()
                .stream()
                .filter(resource -> resource.equals(currentRowResource) && !checkMenuItem.isSelected())
                .forEach(resource -> checkMenuItem.setSelected(true));
        checkMenuItem.setOnAction(event -> {
            if (checkMenuItem.isSelected()) {
                controller.getCommandExecutor().execute(new AddResourceToTaskCommand(task, currentRowResource));
            } else {
                controller.getCommandExecutor().execute(new RemoveResourceFromTaskCommand(task, currentRowResource));
            }
        });
        menuItemList.add(checkMenuItem);
    }
}
项目:Cachoeira    文件:TaskContextMenu.java   
private void refreshResourceMenu(ObservableList<MenuItem> menuItemList,
                                 ITask task,
                                 ObservableList<IResource> resourceList) {
    menuItemList.clear();
    for (IResource resource : resourceList) {                                                                  //берем список всех ресурсов
        CheckMenuItem checkMenuItem = new CheckMenuItem(resource.getName());                                //создаем элемент меню для каждого ресурса
        task.getResourceList()
                .stream()
                .filter(resourceOfTask -> resource.equals(resourceOfTask) && !checkMenuItem.isSelected())
                .forEach(resourceOfTask -> checkMenuItem.setSelected(true));
        checkMenuItem.setOnAction(event -> {
            if (checkMenuItem.isSelected()) {
                controller.getCommandExecutor().execute(new AddResourceToTaskCommand(task, resource));
            } else {
                controller.getCommandExecutor().execute(new RemoveResourceFromTaskCommand(task, resource));
            }
        });
        menuItemList.add(checkMenuItem);
    }
}
项目:jfx-torrent    文件:ApplicationWindow.java   
private ContextMenu buildRemoveButtonContextMenu() {
    final ContextMenu removeOptionsMenu = new ContextMenu();

    final List<RadioMenuItem> removeOptionMenuItems = Arrays.asList(new RadioMenuItem[]{
            new RadioMenuItem("Remove"), new RadioMenuItem("Remove and delete .torrent"),
            new RadioMenuItem("Remove and delete .torrent + Data"),
            new RadioMenuItem("Remove and delete Data")});

    final ToggleGroup removeOptionsToggle = new ToggleGroup();
    removeOptionMenuItems.forEach(i -> i.setToggleGroup(removeOptionsToggle));
    removeOptionMenuItems.get(0).setSelected(true);

    removeOptionsMenu.getItems().addAll(removeOptionMenuItems);
    removeOptionsMenu.getItems().addAll(new SeparatorMenuItem(),
            new CheckMenuItem("Move to trash if possible"));

    return removeOptionsMenu;
}
项目:jfx-torrent    文件:TabActionHandler.java   
private void onResetTabs(final List<CheckMenuItem> checkMenuItems,
        final TabPane tabPane, final Map<String, Tab> tabMap) {
    tabPane.getTabs().clear();
    final Set<String> defaultVisibleTabNames = Arrays.stream(GuiProperties.DEFAULT_TAB_VISIBILITY.split(
            GuiProperties.COMPOSITE_PROPERTY_VALUE_SEPARATOR)).collect(Collectors.toSet());
    checkMenuItems.stream().filter(mi -> mi instanceof CheckMenuItem).forEach(cm -> {
        final CheckMenuItem tabVisibilityCheck = (CheckMenuItem)cm;
        tabVisibilityCheck.setDisable(false);
        final String tabId = tabVisibilityCheck.getId();            
        final boolean tabVisible = defaultVisibleTabNames.contains(tabId);              
        if(tabVisible) {
            tabPane.getTabs().add(tabMap.get(tabId));
        }
    });
    checkMenuItems.stream().forEach(cm -> cm.setSelected(defaultVisibleTabNames.contains(cm.getId())));     
}
项目:lttng-scope    文件:ArrowSeriesMenuButton.java   
public ArrowSeriesMenuButton(TimeGraphWidget widget) {
    ITimeGraphModelProvider modelProvider = widget.getControl().getModelRenderProvider();
    Collection<TimeGraphModelArrowProvider> arrowProviders = modelProvider.getArrowProviders();

    Collection<CheckMenuItem> arrowSeriesItems = arrowProviders.stream()
            .map(arrowProvider -> {
                TimeGraphArrowSeries series = arrowProvider.getArrowSeries();
                String name = series.getSeriesName();
                Arrow graphic = getArrowGraphicForSeries(series);
                CheckMenuItem cmi = new CheckMenuItem(name, graphic);
                cmi.selectedProperty().bindBidirectional(arrowProvider.enabledProperty());
                return cmi;
            })
            .collect(Collectors.toList());

    setText(Messages.arrowSeriesMenuButtonName);
    getItems().addAll(arrowSeriesItems);

    if (arrowSeriesItems.isEmpty()) {
        setDisable(true);
    }
}
项目:lttng-scope    文件:FilterModeMenuButton.java   
public FilterModeMenuButton(TimeGraphWidget viewer) {
    ITimeGraphModelProvider provider = viewer.getControl().getModelRenderProvider();

    Collection<CheckMenuItem> filterModeItems = IntStream.range(0, provider.getFilterModes().size())
            .mapToObj(index -> {
                FilterMode fm = provider.getFilterModes().get(index);
                CheckMenuItem cmi = new CheckMenuItem(fm.getName());
                cmi.setOnAction(e -> {
                    if (cmi.isSelected()) {
                        /* Mode was enabled */
                        provider.enableFilterMode(index);
                    } else {
                        /* Mode was disabled */
                        provider.disableFilterMode(index);
                    }
                    viewer.getControl().repaintCurrentArea();
                });
                return cmi;
            })
            .collect(Collectors.toList());

    setText(Messages.sfFilterModeMenuButtonName);
    getItems().addAll(filterModeItems);

    if (filterModeItems.isEmpty()) {
        setDisable(true);
    }

    /* TODO Re-enable once filter modes are implemented and working */
    setDisable(true);
}
项目:marathonv5    文件:FXUIUtils.java   
public static MenuItem createCheckboxMenuItem(String name, String commandName, String mnemonic) {
    MenuItem menuItem = new CheckMenuItem();
    menuItem.setId(name + "MenuItem");
    Node enabledIcon = getImageFrom(name, "icons/", FromOptions.NULL_IF_NOT_EXISTS);
    if (enabledIcon != null) {
        menuItem.setGraphic(enabledIcon);
    }
    menuItem.setText(commandName);
    if (!"".equals(mnemonic)) {
        menuItem.setAccelerator(KeyCombination.keyCombination(mnemonic));
    }
    return menuItem;
}
项目:Dayflower-Path-Tracer    文件:JavaFX.java   
public static CheckMenuItem newCheckMenuItem(final String text, final EventHandler<ActionEvent> eventHandler, final boolean isSelected) {
    final
    CheckMenuItem checkMenuItem = new CheckMenuItem(text);
    checkMenuItem.setOnAction(eventHandler);
    checkMenuItem.setSelected(isSelected);

    return checkMenuItem;
}
项目:Projeto-IP2    文件:AtualizarProfessorController.java   
public void addExcluir(List<CheckMenuItem> me) {
    Excluir.setOnMouseClicked(e ->{
            System.out.println("teste");
            //Excluir.getItems().addAll(DisciplinaExcluir.add(me));

    });
}
项目:Projeto-IP2    文件:AtualizarProfessor.java   
public void adiciona() {
    List<CheckMenuItem> me = new ArrayList<>();
    if(DisciplinaController.getInstance().retornaListaDisciplina()!=null) { 
        lista = DisciplinaController.getInstance().retornaListaDisciplina();
        for(int i = 0; i < this.lista.size(); i++) {
            me.add(new CheckMenuItem(this.lista.get(i).getNome()));
        }
    }
    CheckMenuItem[] array = me.toArray(new CheckMenuItem[me.size()]);
    if(array.length>0) {
        menu2.getItems().addAll(array);
    }
}
项目:Projeto-IP2    文件:AtualizarProfessor.java   
public static void add(List<CheckMenuItem> me) {
    if(menu1.getItems().isEmpty()==true) {
        menu1.getItems().clear();
    }
        CheckMenuItem[] array = me.toArray(new CheckMenuItem[me.size()]);
        menu1.getItems().addAll(array);


}
项目:Projeto-IP2    文件:CadastroProfessor.java   
public void adiciona() {
    List<CheckMenuItem> me = new ArrayList<>();
    if(DisciplinaController.getInstance().retornaListaDisciplina()!=null) { 
        lista = DisciplinaController.getInstance().retornaListaDisciplina();
        for(int i = 0; i < this.lista.size(); i++) {
            me.add(new CheckMenuItem(this.lista.get(i).getNome()));
        }
    }
    CheckMenuItem[] array = me.toArray(new CheckMenuItem[me.size()]);
    menu.getItems().addAll(array);
}
项目:Projeto-IP2    文件:DisciplinasDisponiveis.java   
public static CheckMenuItem[] adiciona() {
    List<CheckMenuItem> me = new ArrayList<>();
    if(DisciplinaController.getInstance().retornaListaDisciplina()!=null) { 
        lista = DisciplinaController.getInstance().retornaListaDisciplina();
        for(int i = 0; i < lista.size(); i++) {
            me.add(new CheckMenuItem(lista.get(i).getNome()));
        }
    }
    CheckMenuItem[] array = me.toArray(new CheckMenuItem[me.size()]);
    return array;
}
项目:CalendarFX    文件:HelloEntryViewBase.java   
@Override
protected Node createControl() {
    entryView = createEntryView(entry);
    entryView.getStylesheets().add(HelloDayEntryView.class.getResource("entry.css").toExternalForm());
    control = entryView;

    ContextMenu menu = new ContextMenu();

    // red border
    CheckMenuItem redBorder = new CheckMenuItem("Red Border");
    menu.getItems().add(redBorder);
    redBorder.setOnAction(evt -> {
        if (redBorder.isSelected()) {
            entry.getStyleClass().add(RED_BORDER_STYLE);
        } else {
            entry.getStyleClass().remove(RED_BORDER_STYLE);
        }
    });

    // red background
    CheckMenuItem redBackground = new CheckMenuItem("Orange Background");
    menu.getItems().add(redBackground);
    redBackground.setOnAction(evt -> {
        if (redBackground.isSelected()) {
            entry.getStyleClass().add(ORANGE_BACKGROUND_STYLE);
        } else {
            entry.getStyleClass().remove(ORANGE_BACKGROUND_STYLE);
        }
    });

    entryView.setContextMenu(menu);

    return entryView;
}
项目:FxEditor    文件:CAction.java   
public void attach(MenuItem m)
{
    m.setOnAction(this);
    m.disableProperty().bind(disabledProperty());

    if(m instanceof CheckMenuItem)
    {
        ((CheckMenuItem)m).selectedProperty().bindBidirectional(selectedProperty());
    }
    else if(m instanceof RadioMenuItem)
    {
        ((RadioMenuItem)m).selectedProperty().bindBidirectional(selectedProperty());
    }
}
项目:xframium-java    文件:PluginsStage.java   
private void itemSelected (ActionEvent e)
{
  CheckMenuItem menuItem = ((CheckMenuItem) e.getSource ());
  PluginEntry pluginEntry = (PluginEntry) menuItem.getUserData ();
  pluginEntry.select (menuItem.isSelected ());
  rebuildMenu ();
}
项目:myWMS    文件:MyWMS.java   
public VBox makeMenuBar() {
      Menu fileMenu = new Menu("_File");

      fileMenu.getItems().add(createZoomMenus());
      fileMenu.getItems().add(new SeparatorMenuItem());

      MenuItem mi = new MenuItem("Garbage Collect");
      mi.setOnAction((e) -> System.gc());
      fileMenu.getItems().add(mi);

      fileMenu.getItems().add(new SeparatorMenuItem());

      CheckMenuItem hideToolBar = new CheckMenuItem("Hide toolbar");

      MenuItem mi2 = new MenuItem("Exit");
      mi2.setOnAction((e) -> {
            Platform.exit();
            System.exit(0);
      });
      fileMenu.getItems().addAll(hideToolBar, mi2);

      MenuBar menuBar = new MenuBar();
      menuBar.setUseSystemMenuBar(true);
        menuBar.getMenus().addAll(fileMenu);

    List<MyWMSMainMenuPlugin> runners = getActions();
    for (MyWMSMainMenuPlugin m : runners) {
      runnerActions.put(m.getPath(), m);
    }

    MenuUtils.buildMenu(context, menuBar, runners,  applicationPane.getOnAddNode());

//    ToolBar tool = makeToolBar(toolBarActions);
//    tool.managedProperty().bind(tool.visibleProperty());
//    tool.visibleProperty().bind(hideToolBar.selectedProperty().not());

      VBox box = new VBox(menuBar);

    return box;
    }
项目:openjfx-8u-dev-tests    文件:MenuItemApp.java   
public MixedItemsMenu() {
    super(MIXED_ID);
    setId(MIXED_ID);

    MenuItem graphics_menu_item = new MenuItem(MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_menu_item.setId(MENU_ITEM_GRAPHICS_ID);
    graphics_menu_item.setAccelerator(MENU_ITEM_ACCELERATOR);

    CheckMenuItem graphics_check_menu_item = new CheckMenuItem(CHECK_MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_check_menu_item.setId(CHECK_MENU_ITEM_GRAPHICS_ID);
    graphics_check_menu_item.setAccelerator(CHECK_MENU_ITEM_ACCELERATOR);

    RadioMenuItem graphics_radio_menu_item = new RadioMenuItem(RADIO_MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_radio_menu_item.setId(RADIO_MENU_ITEM_GRAPHICS_ID);
    graphics_radio_menu_item.setAccelerator(RADIO_MENU_ITEM_ACCELERATOR);

    HBox node_box_bool = new HBox();
    node_box_bool.getChildren().addAll(new Rectangle(10, 10), new Label(NODE_MENU_ITEM_BOOL_ID));
    CustomMenuItem graphics_node_menu_item = new CustomMenuItem(node_box_bool, true);
    graphics_node_menu_item.setId(NODE_MENU_ITEM_BOOL_ID);
    graphics_node_menu_item.setAccelerator(NODE_MENU_ITEM_ACCELERATOR);

    SeparatorMenuItem separator_menu_item = new SeparatorMenuItem();
    separator_menu_item.setId(SEPARATOR_MENU_ITEM_VOID_ID);

    getItems().addAll(graphics_menu_item,
            graphics_check_menu_item,
            graphics_radio_menu_item,
            graphics_node_menu_item,
            separator_menu_item);

    setEventHandlers();
}
项目:openjfx-8u-dev-tests    文件:MenuItemApp.java   
public CheckItemsMenu() {
    super(CHECK_ID);
    setId(CHECK_ID);

    for (int i = 0; i < 3; i++) {
        CheckMenuItem item = new CheckMenuItem("Item " + i, new Rectangle(10, 10));
        item.setId(item.getText());
        getItems().add(item);
    }
    setEventHandlers();
}
项目:openjfx-8u-dev-tests    文件:MenuItemApp.java   
public AllInvisibleItemsMenu() {
    super(ALL_INVISIBLE_ID);
    setId(ALL_INVISIBLE_ID);

    getItems().addAll(
            new MenuItem("Invisible Menu Item", new Rectangle(10, 10)),
            new CheckMenuItem("Invisible Check Item", new Rectangle(10, 10)),
            new RadioMenuItem("Invisible Radio Item", new Rectangle(10, 10)),
            new CustomMenuItem(new Label("Invisible Custom Item")));

    setEventHandlers();
}
项目:ReqTraq    文件:CAction.java   
public void attach(MenuItem m)
{
    m.setOnAction(this);
    m.disableProperty().bind(disabledProperty());

    if(m instanceof CheckMenuItem)
    {
        ((CheckMenuItem)m).selectedProperty().bindBidirectional(selectedProperty());
    }
    else if(m instanceof RadioMenuItem)
    {
        ((RadioMenuItem)m).selectedProperty().bindBidirectional(selectedProperty());
    }
}
项目:FxDock    文件:CAction.java   
public void attach(MenuItem m)
{
    m.setOnAction(this);
    m.disableProperty().bind(disabledProperty());

    if(m instanceof CheckMenuItem)
    {
        ((CheckMenuItem)m).selectedProperty().bindBidirectional(selectedProperty());
    }
    else if(m instanceof RadioMenuItem)
    {
        ((RadioMenuItem)m).selectedProperty().bindBidirectional(selectedProperty());
    }
}
项目:qupath    文件:CommandFinderTools.java   
static void fireMenuItem(final MenuItem menuItem) {
    if (menuItem instanceof CheckMenuItem)
        fireMenuItem((CheckMenuItem)menuItem);
    else if (menuItem instanceof RadioMenuItem)
        fireMenuItem((RadioMenuItem)menuItem);
    else
        menuItem.fire();
}
项目:Gamma-Music-Manager    文件:MenuUI.java   
/**
   * Get the minimode Menu
*
   * @return The minimode menu
   */
  private Menu getMinimodeMenu() {
      Menu minimodeMenu = new Menu(MINI_MODE);
      m_minimodeMenuItem = new CheckMenuItem(MINI_MODE + "!");
      m_minimodeMenuItem.setSelected(m_miniCheck);
      m_minimodeMenuItem.setOnAction(event -> {
          System.out.println("Clicked minimode menu");
          fireMiniMode();
      });
      minimodeMenu.getItems().addAll(m_minimodeMenuItem);
      return minimodeMenu;
  }
项目:3DScanner.RaspberryPi    文件:UIController.java   
/**
     * Hacky solution for the quality selector, which makes it sure only one quality can be selectet at
     * a time. The selected quality is stored as a String in the global variable qualitySelected for a still
     * unsure purpose 
     * @param e
     */
    @FXML
    private void hadleQualitySelect(ActionEvent e){
        Object source = e.getSource();
        selectedMenuItem = (CheckMenuItem) source;
        abnormalHigh.setSelected(false);
        ultraHigh.setSelected(false);
        veryHigh.setSelected(false);
//      high.setSelected(false);
//      medium.setSelected(false);
//      low.setSelected(false);
        selectedMenuItem.setSelected(true);
        qualitySelected = selectedMenuItem.getId();
        switch (qualitySelected.toLowerCase().charAt(0)){
            case 'l': bilderZahl = 16;
            System.out.println("hello777");
            break;
            case 'm': bilderZahl = 32;
            System.out.println("hello123");
            break;
            case 'h': bilderZahl = 64;
            break;
            case 'v': bilderZahl = 128;
            break;
            case 'u': bilderZahl = 256;
            break;
            case 'a': bilderZahl = 512;
            break;  
        }
        System.out.println(bilderZahl);
        qualityChoose.setText("Qualit\u00E4t: "+ selectedMenuItem.getText());
        //System.out.println(qualitySelected + " Qualität Selektiert"); 
        System.out.println(selectedMenuItem.getText() + qualitySelected );
        // Btw \u00E4 das ist ein kleines ä in unicode http://www.bennyn.de/programmierung/java/umlaute-und-sonderzeichen-in-java.html
    }
项目:FXGL    文件:DeveloperMenuBarController.java   
public void onShowBBox(ActionEvent event) {
    CheckMenuItem item = (CheckMenuItem) event.getSource();
    FXGL.setProperty("dev.showbbox", item.isSelected());

    app.getGameWorld()
            .getEntitiesByComponent(ViewComponent.class)
            .forEach(e -> {
                e.getComponent(ViewComponent.class).turnOnDebugBBox(item.isSelected());
            });
}
项目:FXGL    文件:DeveloperMenuBarController.java   
public void onTrackClicks(ActionEvent event) {
    CheckMenuItem item = (CheckMenuItem) event.getSource();

    if (item.isSelected()) {
        //app.getGameScene().addEventHandler(MouseEvent.MOUSE_PRESSED, clickTracker);
    } else {
        //app.getGameScene().removeEventHandler(MouseEvent.MOUSE_PRESSED, clickTracker);
    }
}