本文整理匯總了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;
}
示例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;
}
示例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));
}
示例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();
});
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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
}
示例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();
};
}
示例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);
}
}
示例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);
}
}