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


Java RadioMenuItem类代码示例

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


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

示例1: marathon_select

import javafx.scene.control.RadioMenuItem; //导入依赖的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.RadioMenuItem; //导入依赖的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: updateMenuItems

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

示例4: initMenu

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
private void initMenu() {
  recentSupport = new RecentFileMenuSupport(openRecentMenu) {
    @Override
    public List<String> load() {
      return Arrays.asList(Config.getProperty(ConfigKey.RECENT_LOCATIONS, "").split(","));
    }

    @Override
    public void save(List<String> s) {
      Config.setProperty(ConfigKey.RECENT_LOCATIONS, String.join(", ", s));
    }
  };
  recentSupport.setOnAction(this::openFile);

  ToggleGroup group = new ToggleGroup();
  for (SkinStyle style : Context.SKIN.getSkinList()) {
    RadioMenuItem item = new RadioMenuItem(style.getName());
    item.setToggleGroup(group);
    item.setOnAction(e -> Context.SKIN.changeSkin(style));
    if (Context.SKIN.currentSkin() == style) {
      item.setSelected(true);
    }
    skinMenu.getItems().add(item);
  }
}
 
开发者ID:XDean,项目名称:CSS-Editor-FX,代码行数:26,代码来源:MainFrameController.java

示例5: chooseBackground

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
private void chooseBackground(int background, ActionEvent event) {
	if (background == IMAGE_1) {
		ArmaDialogCreator.getCanvasView().setCanvasBackgroundToImage(ADCImagePaths.BG_1);
	} else if (background == IMAGE_2) {
		ArmaDialogCreator.getCanvasView().setCanvasBackgroundToImage(ADCImagePaths.BG_2);
	} else if (background == IMAGE_3) {
		ArmaDialogCreator.getCanvasView().setCanvasBackgroundToImage(ADCImagePaths.BG_3);
	} else if (background == NO_IMAGE) {
		ArmaDialogCreator.getCanvasView().setCanvasBackgroundToImage(null);
	} else if (background == IMAGE_CUSTOM) {
		FileChooser c = new FileChooser();
		FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("Images", "*.png", "*.gif", "*.jpg", "*.mpo");
		c.getExtensionFilters().add(filter);
		c.setSelectedExtensionFilter(filter);
		c.setTitle(Lang.ApplicationBundle().getString("Misc.file_chooser_background_img_title"));
		File chosen = c.showOpenDialog(ArmaDialogCreator.getPrimaryStage());
		if (chosen != null) {
			ArmaDialogCreator.getCanvasView().setCanvasBackgroundToImage(chosen.toURI().toString());
		} else {
			RadioMenuItem target = (RadioMenuItem) event.getTarget();
			target.getToggleGroup().selectToggle(target.getToggleGroup().getToggles().get(lastBackground));
		}
	}
}
 
开发者ID:kayler-renslow,项目名称:arma-dialog-creator,代码行数:25,代码来源:ViewBackgroundAction.java

示例6: InvisibleItemsMenu

import javafx.scene.control.RadioMenuItem; //导入依赖的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

示例7: radioGroupTest

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
@Smoke
@Test(timeout = 300000)
public void radioGroupTest() throws InterruptedException {
    Wrap<? extends Menu> menu = menuBarAsParent.lookup(new MenuByText(MenuItemApp.RADIO_ID)).wrap();
    Parent<MenuItem> menu_as_parent = menu.as(Parent.class, MenuItem.class);
    for (int i = 0; i < menu_as_parent.lookup().size(); i++) {
        Wrap<? extends MenuItem> item_wrap = menu_as_parent.lookup().wrap(i);
        MenuItem item = item_wrap.getControl();
        expand(menu, true);
        item_wrap.mouse().click();
        for (int j = 0; j < menu_as_parent.lookup().size(); j++) {
            Wrap<? extends MenuItem> another_item_wrap = menu_as_parent.lookup().wrap(i);
            final MenuItem another_item = another_item_wrap.getControl();
            expand(menu, true);
            item_wrap.mouse().click();
            if (!another_item.equals(item)) {
                assertFalse(new GetAction<Boolean>() {
                    @Override
                    public void run(Object... parameters) {
                        setResult(((RadioMenuItem) another_item).isSelected());
                    }
                }.dispatch(Root.ROOT.getEnvironment()));
            }
        }
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:27,代码来源:MenuItemTest.java

示例8: wrap

import javafx.scene.control.RadioMenuItem; //导入依赖的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

示例9: getCurrentClockSpeed

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
private int getCurrentClockSpeed() {
	for(MenuItem menuItem : frequenciesMenu.getItems()) {
		RadioMenuItem clockItem = (RadioMenuItem)menuItem;
		if(clockItem.isSelected()) {
			String text = clockItem.getText();
			int space = text.indexOf(' ');
			if(space == -1) {
				throw new IllegalStateException("What did you do...");
			}
			
			return Integer.parseInt(text.substring(0, space));
		}
	}
	
	throw new IllegalStateException("This can't happen lol");
}
 
开发者ID:ra4king,项目名称:CircuitSim,代码行数:17,代码来源:CircuitSim.java

示例10: initializeZoomOptions

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
/**
 * Initializes the list of zoom options.
 */
private void initializeZoomOptions() {

    final ToggleGroup toggleGroup = new ToggleGroup();

    for (int i = 1; i <= 5; i++) {

        final RadioMenuItem zoomOption = new RadioMenuItem();
        final double zoomFactor = i;

        zoomOption.setText(i + "00%");
        zoomOption.setOnAction(event -> setZoomFactor(zoomFactor));

        toggleGroup.getToggles().add(zoomOption);
        zoomOptions.getItems().add(zoomOption);

        if (i == 1) {
            zoomOption.setSelected(true);
        }
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:24,代码来源:GraphEditorDemoController.java

示例11: initialize

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    closeJarButton.setDisable(Main.getLoadedJar() == null);
    loadMappingsButton.setDisable(Main.getLoadedJar() == null);
    mergeMappingsButton.setDisable(Main.getLoadedJar() == null);
    saveMappingsButton.setDisable(Main.getLoadedJar() == null);
    saveMappingsAsButton.setDisable(Main.getLoadedJar() == null);
    resetMappingsButton.setDisable(Main.getLoadedJar() == null);

    final String langRadioPrefix = "langRadio-";
    for (Toggle toggle : languageGroup.getToggles()) {
        if (((RadioMenuItem) toggle).getId().equals(langRadioPrefix + Main.getCurrentLocale())) {
            toggle.setSelected(true);
            break;
        }
    }

    setAccelerators();

    this.initTreeViews();

    RESTART_ALERT.setTitle(Main.getResourceBundle().getString("dialog.restart.title"));
    RESTART_ALERT.setHeaderText(null);
    RESTART_ALERT.setContentText(Main.getResourceBundle().getString("dialog.restart.content"));
}
 
开发者ID:LapisBlue,项目名称:Nocturne,代码行数:26,代码来源:MainController.java

示例12: onPriorityAction

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
private void onPriorityAction(final RadioMenuItem priorityMenuItem) {
	final CheckBoxTreeItem<TorrentFileEntry> treeItem = (CheckBoxTreeItem<TorrentFileEntry>)getTreeItem();
	final FilePriority newPriorityValue = FilePriority.values()[Integer.parseInt(priorityMenuItem.getId())];
	if(treeItem.getValue().getPriority() != newPriorityValue) { 
		if(treeItem.isIndeterminate()) {
			treeItem.setSelected(true);
			treeItem.getValue().selectedProperty().set(newPriorityValue != FilePriority.SKIP);
		}
		else {
			treeItem.setSelected(newPriorityValue != FilePriority.SKIP);
		}
							
		if(!treeItem.isLeaf()) {
			fileTreeViewer.onUpdateChildrenPriority(treeItem, newPriorityValue);
		}
		treeItem.getValue().priorityProperty().set(newPriorityValue);
		fileTreeViewer.onUpdateParentPriority(treeItem.getParent());
		fileTreeViewer.selectItem(treeItem);
	}
}
 
开发者ID:veroslav,项目名称:jfx-torrent,代码行数:21,代码来源:TorrentContentTreeRow.java

示例13: buildRemoveButtonContextMenu

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
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;
}
 
开发者ID:veroslav,项目名称:jfx-torrent,代码行数:19,代码来源:ApplicationWindow.java

示例14: check

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
public static CheckItemBuilt check(String name, boolean checked) {
    RadioMenuItem item = new RadioMenuItem() {
        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            MenuItem i = (MenuItem) o;

            return !(getText() != null ? !getText().equals(i.getText()) : i.getText() != null);

        }

        @Override
        public int hashCode() {
            return getText() != null ? getText().hashCode() : 0;
        }
    };
    item.setMnemonicParsing(false);
    item.setSelected(checked);
    item.setText(name);
    final CheckItemBuilt checkItemBuilt = new CheckItemBuilt(item);
    return checkItemBuilt;
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:25,代码来源:CheckItemBuilt.java

示例15: didClickPlayerMenuItem

import javafx.scene.control.RadioMenuItem; //导入依赖的package包/类
public void didClickPlayerMenuItem(ActionEvent e) {
	ColorTypes type = (ColorTypes)((RadioMenuItem)e.getSource()).getUserData();

	colors.setPlayerColor(new StoneColor(type));
	updateColorMenu();
	draw();
	UserDefaults.sharedDefaults().setKey(UserDefaults.STONE_COLORS_KEY, colors);
}
 
开发者ID:lukasbischof,项目名称:Orsum-occulendi,代码行数:9,代码来源:GameController.java


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