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


Java SeparatorMenuItem类代码示例

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


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

示例1: populateMenuItems

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
private void populateMenuItems(ContextMenu contextMenu, Tab tab) {
    int tabCount = getTabs().size();
    int tabIndex = getTabs().indexOf(tab);
    ObservableList<MenuItem> items = contextMenu.getItems();
    items.clear();
    MenuItem closeMenuItem = new MenuItem("Close");
    closeMenuItem.setOnAction((e) -> requestClose(tab));
    items.add(closeMenuItem);
    if (tabCount > 1) {
        MenuItem closeRestMenuItem = new MenuItem("Close Others");
        closeRestMenuItem.setOnAction((e) -> closeOtherTabs(tab));
        items.add(closeRestMenuItem);
    }
    if (tabCount > 1 && tabIndex != 0) {
        MenuItem closeLeftTabsMenuItem = new MenuItem("Close Tabs to the Left");
        closeLeftTabsMenuItem.setOnAction((e) -> closeTabsToLeft(tab));
        items.add(closeLeftTabsMenuItem);
    }
    if (tabCount > 1 && tabIndex != tabCount - 1) {
        MenuItem closeRigthTabsMenuItem = new MenuItem("Close Tabs to the Right");
        closeRigthTabsMenuItem.setOnAction((e) -> closeTabsToRight(tab));
        items.add(closeRigthTabsMenuItem);
    }
    if (tabCount > 1) {
        MenuItem closeAllMenuItem = new MenuItem("Close All");
        closeAllMenuItem.setOnAction((e) -> closeAllTabs());
        items.addAll(new SeparatorMenuItem(), closeAllMenuItem);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:30,代码来源:TabDockingContainer.java

示例2: menuPath

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
@Test public void menuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");
        MenuItem clear = new MenuItem("Clear");
        MenuItem exit = new MenuItem("Exit");
        menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>Clear", path.get(0));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:RFXMenuItemTest.java

示例3: menuItemIconNoText

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
@Test public void menuItemIconNoText() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");
        MenuItem clear = new MenuItem();
        clear.setGraphic(new ImageView(RFXTabPaneTest.imgURL.toString()));
        MenuItem exit = new MenuItem("Exit");
        menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>middle", path.get(0));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:RFXMenuItemTest.java

示例4: duplicateMenuPath

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
@Test public void duplicateMenuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");

        MenuItem clear = new MenuItem("Clear");
        MenuItem clear1 = new MenuItem("Clear");
        MenuItem clear2 = new MenuItem("Clear");

        MenuItem exit = new MenuItem("Exit");

        menuFile.getItems().addAll(add, clear, clear1, clear2, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear2));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>Clear(2)", path.get(0));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:RFXMenuItemTest.java

示例5: FileTreeMenu

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
public FileTreeMenu(FileTreeView view) {
    this.view = view;

    this.setOnShowing(event -> {
        Log.trace("Show Context Menu");
        FileTreeNode node = view.getSelected();
        if (node == null) {
            this.getItems().clear();
        } else {
            try {
                node.updateMenu(view.getViewer(), this);
            } catch (Exception e) {
                Log.error(e);
                ViewerAlert.exceptionAlert(e);
                this.getItems().clear();
            }
        }
    });

    this.getItems().add(new SeparatorMenuItem());
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:22,代码来源:FileTreeMenu.java

示例6: addMenu

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
public void addMenu(final String name, final MenuCategory... menuCats)
{
    final Menu newItem = new MenuTranslate(name);

    // add menus
    for (final MenuCategory mc : menuCats)
        // check if category is not empty
        if (mc.getItems().size() > 0)
        {
            // add a separator
            if (newItem.getItems().size() != 0)
                newItem.getItems().add(new SeparatorMenuItem());
            // add all menu items
            newItem.getItems().addAll(mc.getItems());
        }

    this.listMenu.add(newItem);
    this.menu.getMenus().add(newItem);
}
 
开发者ID:Leviathan-Studio,项目名称:MineIDE,代码行数:20,代码来源:MenuManagement.java

示例7: initialize

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
public void initialize() {
    MenuBar menuBar = new MenuBar();
    // Make same width as the stage
    menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
    rootPane.setTop(menuBar);

    // File menu - new, save, exit
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = createMenuItem("New", actionEvent -> this.onNewFile());

    MenuItem openMenuItem = createMenuItem("Open", actionEvent -> this.onOpenFile());

    MenuItem saveMenuItem = createMenuItem("Save", actionEvent -> this.onSaveFile());
    saveMenuItem.disableProperty().bind(jwkSetData.changedProperty().not());

    MenuItem exitMenuItem = createMenuItem("Exit", actionEvent -> Platform.exit());

    fileMenu.getItems().addAll(newMenuItem, openMenuItem, saveMenuItem,
            new SeparatorMenuItem(), exitMenuItem);

    menuBar.getMenus().addAll(fileMenu);
}
 
开发者ID:atbashEE,项目名称:atbash-octopus,代码行数:23,代码来源:ApplicationMenu.java

示例8: GoogleEntryAttendeeItem

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
public GoogleEntryAttendeeItem(EventAttendee attendee) {
    this.attendee = Objects.requireNonNull(attendee);

    optionalIcon = new Label();
    optionalIcon.setOnMouseClicked(evt -> setOptional(!isOptional()));
    optionalIcon.getStyleClass().add("button-icon");
    optionalIcon.setTooltip(new Tooltip());

    statusIcon = new Label();

    name = new Label();
    name.setMaxWidth(Double.MAX_VALUE);

    setOptional(Boolean.TRUE.equals(attendee.getOptional()));
    optionalProperty().addListener(obs -> updateIcon());
    updateIcon();

    removeButton = new Label();
    removeButton.setGraphic(new FontAwesome().create(FontAwesome.Glyph.TRASH_ALT));
    removeButton.getStyleClass().add("button-icon");
    removeButton.setOnMouseClicked(evt -> removeAttendee(attendee));

    HBox.setHgrow(optionalIcon, Priority.NEVER);
    HBox.setHgrow(name, Priority.ALWAYS);
    HBox.setHgrow(removeButton, Priority.NEVER);

    getStyleClass().add("attendee-item");
    getChildren().addAll(optionalIcon, statusIcon, name, removeButton);

    ContextMenu menu = new ContextMenu();
    MenuItem optionalItem = new MenuItem("Mark as optional");
    optionalItem.setOnAction(evt -> setOptional(true));
    MenuItem requiredItem = new MenuItem("Mark as required");
    requiredItem.setOnAction(evt -> setOptional(false));
    MenuItem removeItem = new MenuItem("Remove attendee");
    removeItem.setOnAction(evt -> removeAttendee(attendee));
    menu.getItems().addAll(optionalItem, requiredItem, new SeparatorMenuItem(), removeItem);

    addEventHandler(CONTEXT_MENU_REQUESTED, evt -> menu.show(this, evt.getScreenX(), evt.getScreenY()));
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:41,代码来源:GoogleEntryAttendeesView.java

示例9: initTableContextMenu

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
private void initTableContextMenu() {
      TextField textField = new TextField("Type Something"); // we will add a popup menu to this text field
      contextMenu = new ContextMenu();

      MenuItem pauseP = new MenuItem("Stop process");
pauseP.setId("pausep");
		
MenuItem continueP = new MenuItem("Continue process");
continueP.setId("continuep");
		
MenuItem killP = new MenuItem("Kill process");
killP.setId("killp");
      
pauseP.setOnAction(actionEventHandler);
continueP.setOnAction(actionEventHandler);
killP.setOnAction(actionEventHandler);


      contextMenu.getItems().addAll(pauseP, continueP, new SeparatorMenuItem(), killP);
      // ...
      textField.setContextMenu(contextMenu);
  }
 
开发者ID:dhiogoboza,项目名称:SystemMonitorJFX,代码行数:23,代码来源:MainStage.java

示例10: createFileMenu

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
private Menu createFileMenu() {
    Menu menuFile = new Menu("File");
    menuFileNew = new Menu("New");
    menuFileGenerators = new Menu("Generators");

    // "Save" is initially disabled because we do not have a structure.
    menuFileSave = createMenuItem("Save graph as...", handlers.onSave);
    menuFileSave.setDisable(true);
    menuFile.getItems().addAll(
        menuFileNew, menuFileGenerators,
        createMenuItem("Open graph...", handlers.onOpen),
        createMenuItem("Direct input...", handlers.onDirectInput),
        menuFileSave,
        new SeparatorMenuItem(),
        createMenuItem("Load plugin...", handlers.onLoadPlugin),
        new SeparatorMenuItem(),
        createMenuItem("Exit", handlers.onExit));

    return menuFile;
}
 
开发者ID:gralog,项目名称:gralog,代码行数:21,代码来源:MainMenu.java

示例11: configureRecentFilesMenu

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
/**
 * Binds the recent files menu to the recent files in the config.
 */
private void configureRecentFilesMenu() {
    ListChangeListener<String> updateRecentFilesMenu = change -> {
        ObservableList<MenuItem> items = recentFilesMenu.getItems();
        items.clear();
        if (config.getState().getRecentFiles().isEmpty()) {
            MenuItem noItem = new MenuItem("No recent file");
            noItem.setDisable(true);
            items.add(noItem);
        } else {
            config.getState().getRecentFiles().stream().map(path -> {
                MenuItem menuItem = new MenuItem(path);
                menuItem.setOnAction(event -> openRecentFile(path));
                return menuItem;
            }).forEach(items::add);
            MenuItem sep = new SeparatorMenuItem();
            items.add(sep);
            MenuItem clearItem = new MenuItem("Clear recent files");
            clearItem.setOnAction(event -> config.getState().getRecentFiles().clear());
            items.add(clearItem);
        }
    };
    config.getState().getRecentFiles().addListener(updateRecentFilesMenu);
    // manual trigger the first time for initialization
    updateRecentFilesMenu.onChanged(null);
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:29,代码来源:MainController.java

示例12: selectionCycle

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
protected void selectionCycle(boolean enabled, boolean event) {
    clearLastSelectedBtn.mouse().click();
    clearLastEventBtn.mouse().click();
    Wrap<? extends Menu> menu = menuBarLookup.lookup(new MenuByText(MenuItemApp.MIXED_ID)).wrap();
    Parent<MenuItem> menu_as_parent = menu.as(Parent.class, MenuItem.class);
    for (int i = 0; i < menu_as_parent.lookup().size(); i++) {
        menu_as_parent = menu.as(Parent.class, MenuItem.class);
        Wrap<? extends MenuItem> item_wrap = menu_as_parent.lookup().wrap(i);
        MenuItem item = item_wrap.getControl();
        if (SeparatorMenuItem.class.isInstance(item)) {
            continue;
        }
        expand(menu, true);
        item_wrap.mouse().click();
        lastSelected.waitProperty(Wrap.TEXT_PROP_NAME, enabled ? item.getId() : "");
        lastEvent.waitProperty(Wrap.TEXT_PROP_NAME, event ? item.getId() : "");
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:19,代码来源:MenuItemTest.java

示例13: themeMenu

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
/**
 * Dynamically generates the Theme menu.
 *
 * @param menu
 *            The menu item to attach to
 * @return The completed menu
 */
private Menu themeMenu(Menu menu) {
	menu.getItems().clear();

	for (Theme t : wm.getThemes()) {
		MenuItem item = new MenuItem(t.getName());
		item.setOnAction(e -> wm.getThemes().setTheme(t));
		menu.getItems().add(item);
	}

	MenuItem reloadThemeItem = new MenuItem("Refresh Themes");
	reloadThemeItem.setOnAction(e -> {
		wm.getThemes().reload();
		themeMenu(menu);
		wm.getThemes().setTheme(wm.getThemes().getTheme());
	});

	menu.getItems().addAll(new SeparatorMenuItem(), reloadThemeItem);
	return menu;
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:27,代码来源:MainMenuBar.java

示例14: windowsMenuHelper

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

示例15: applyControls

import javafx.scene.control.SeparatorMenuItem; //导入依赖的package包/类
/**
 * Method to apply the functions available to the menu.
 */
private void applyControls() {
   rightWallControl = new MenuItem( HIDE_RIGHT );
   rightWallControl.setOnAction( event -> controlRightWall( display, rightWallControl ) );
   
   leftWallControl = new MenuItem( HIDE_LEFT );
   leftWallControl.setOnAction( event -> controlLeftWall( display, leftWallControl ) );
   
   imageFlasherControl = new MenuItem( CONFIGURE_IMAGE_FLASHER );
   imageFlasherControl.setOnAction( event -> display.showImageFlasherConfiguration() );
   
   MenuItem hideConfig = new MenuItem( HIDE_CONFIGURATION );
   hideConfig.setOnAction( event -> display.hideConfiguration() );
   
   getItems().addAll( 
         leftWallControl, 
         rightWallControl,
         new SeparatorMenuItem(),
         imageFlasherControl,
         hideConfig
   );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:25,代码来源:DualBuildWallContextMenu.java


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