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