当前位置: 首页>>代码示例>>Java>>正文


Java CheckMenuItem类代码示例

本文整理汇总了Java中javafx.scene.control.CheckMenuItem的典型用法代码示例。如果您正苦于以下问题:Java CheckMenuItem类的具体用法?Java CheckMenuItem怎么用?Java CheckMenuItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CheckMenuItem类属于javafx.scene.control包,在下文中一共展示了CheckMenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: marathon_select

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
@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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:JavaFXMenuBarElement.java

示例2: marathon_select

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
@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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:JavaFXContextMenuElement.java

示例3: specialChars

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
@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));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:RFXMenuItemTest.java

示例4: confirma

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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();
	});
}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:22,代码来源:EventosCadastroProfessorController.java

示例5: adiciona

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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);
}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:24,代码来源:RemoverDisciplina.java

示例6: adiciona

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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);
}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:24,代码来源:AtualizarDisciplina.java

示例7: adiciona

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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);
}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:24,代码来源:ProcurarDisciplina.java

示例8: InvisibleItemsMenu

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:MenuItemApp.java

示例9: wrap

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
@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);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:19,代码来源:MenuItemParent.java

示例10: windowsMenuHelper

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:28,代码来源:MainMenuBar.java

示例11: createSearchSubmenu

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:ijh165,项目名称:Gamma-Music-Manager,代码行数:25,代码来源:MenuUI.java

示例12: hadleDauerSelect

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
/**
 * 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
}
 
开发者ID:Raldir,项目名称:3DScanner.RaspberryPi,代码行数:31,代码来源:UIController.java

示例13: handleStartWithWindowsClick

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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();
	};
}
 
开发者ID:ck3ck3,项目名称:WhoWhatWhere,代码行数:26,代码来源:SettingsManager.java

示例14: refreshTaskMenu

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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);
    }
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:21,代码来源:ResourceContextMenu.java

示例15: refreshResourceMenu

import javafx.scene.control.CheckMenuItem; //导入依赖的package包/类
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);
    }
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:21,代码来源:TaskContextMenu.java


注:本文中的javafx.scene.control.CheckMenuItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。