本文整理汇总了Java中javafx.scene.control.MenuBar.setUseSystemMenuBar方法的典型用法代码示例。如果您正苦于以下问题:Java MenuBar.setUseSystemMenuBar方法的具体用法?Java MenuBar.setUseSystemMenuBar怎么用?Java MenuBar.setUseSystemMenuBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.MenuBar
的用法示例。
在下文中一共展示了MenuBar.setUseSystemMenuBar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMenuBar
import javafx.scene.control.MenuBar; //导入方法依赖的package包/类
private MenuBar createMenuBar(GoogleAutoRefreshThread autoRefreshThread) {
MenuItem logoutItem = new MenuItem("Logout");
logoutItem.setOnAction(evt -> logout());
MenuItem exitItem = new MenuItem("Exit");
exitItem.setAccelerator(KeyCombination.keyCombination("shortcut+q"));
exitItem.setOnAction(evt -> Platform.exit());
Menu fileMenu = new Menu("File");
fileMenu.getItems().add(logoutItem);
fileMenu.getItems().add(exitItem);
MenuItem refreshItem = new MenuItem("Refresh");
refreshItem.setOnAction(evt -> autoRefreshThread.restart());
refreshItem.setAccelerator(KeyCombination.keyCombination("F5"));
ToggleGroup intervalGroup = new ToggleGroup();
Menu autoRefreshItem = new Menu("Auto Refresh");
for (GoogleAutoRefreshThread.RefreshInterval interval : GoogleAutoRefreshThread.RefreshInterval.values()) {
RadioMenuItem intervalItem = new RadioMenuItem(interval.getName());
intervalItem.setOnAction(evt -> autoRefreshThread.setDelay(interval.getTime()));
intervalItem.setToggleGroup(intervalGroup);
intervalItem.setSelected(interval.getTime() == autoRefreshThread.getDelay());
autoRefreshItem.getItems().add(intervalItem);
}
Menu viewMenu = new Menu("View");
viewMenu.getItems().addAll(refreshItem, autoRefreshItem);
MenuBar menuBar = new MenuBar();
menuBar.setUseSystemMenuBar(true);
menuBar.getMenus().add(fileMenu);
menuBar.getMenus().add(viewMenu);
return menuBar;
}
示例2: makeMenuBar
import javafx.scene.control.MenuBar; //导入方法依赖的package包/类
public VBox makeMenuBar() {
Menu fileMenu = new Menu("_File");
fileMenu.getItems().add(createZoomMenus());
fileMenu.getItems().add(new SeparatorMenuItem());
MenuItem mi = new MenuItem("Garbage Collect");
mi.setOnAction((e) -> System.gc());
fileMenu.getItems().add(mi);
fileMenu.getItems().add(new SeparatorMenuItem());
CheckMenuItem hideToolBar = new CheckMenuItem("Hide toolbar");
MenuItem mi2 = new MenuItem("Exit");
mi2.setOnAction((e) -> {
Platform.exit();
System.exit(0);
});
fileMenu.getItems().addAll(hideToolBar, mi2);
MenuBar menuBar = new MenuBar();
menuBar.setUseSystemMenuBar(true);
menuBar.getMenus().addAll(fileMenu);
List<MyWMSMainMenuPlugin> runners = getActions();
for (MyWMSMainMenuPlugin m : runners) {
runnerActions.put(m.getPath(), m);
}
MenuUtils.buildMenu(context, menuBar, runners, applicationPane.getOnAddNode());
// ToolBar tool = makeToolBar(toolBarActions);
// tool.managedProperty().bind(tool.visibleProperty());
// tool.visibleProperty().bind(hideToolBar.selectedProperty().not());
VBox box = new VBox(menuBar);
return box;
}
示例3: createMenuBar
import javafx.scene.control.MenuBar; //导入方法依赖的package包/类
private MenuBar createMenuBar() {
MenuBar menuBar = new MenuBar();
Menu darisMenu = createDarisMenu();
menuBar.getMenus().add(darisMenu);
_actionMenu = createActionMenu();
menuBar.getMenus().add(_actionMenu);
menuBar.setUseSystemMenuBar(true);
return menuBar;
}
示例4: start
import javafx.scene.control.MenuBar; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
stage = primaryStage;
createDocumentEditor();
MenuBar menuBar = ActionUtils.createMenuBar( Arrays.asList(
new ActionGroup("File", actions("newdoc", "opendoc", "savedoc", "---", "appexit")),
new ActionGroup("Edit", actions("cut", "copy", "paste"))
));
menuBar.setUseSystemMenuBar(true); // Mac OSX support
ToolBar toolBar = ActionUtils.createToolBar(
actions("newdoc", "opendoc", "savedoc", "---", "cut", "copy", "paste"),
ActionTextBehavior.HIDE
);
BorderPane content = new BorderPane();
content.setTop(new VBox(menuBar, toolBar));
content.setCenter(tabs);
content.setPrefSize(1000, 800);
// Pane statusBar = new Pane( new Label("v 1.0.0"));
// statusBar.setPadding(new Insets(5,5,5,5));
// content.setBottom(statusBar);
primaryStage.setTitle("Markdown Pad FX");
primaryStage.setScene(new Scene(content));
primaryStage.show();
}
示例5: createMenuBar
import javafx.scene.control.MenuBar; //导入方法依赖的package包/类
public static MenuBar createMenuBar(List<Menu> menus) {
MenuBar bar = new MenuBar();
bar.setUseSystemMenuBar(true);
bar.getMenus().addAll(menus);
return bar;
}