當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。