Java 类javafx.scene.control.MenuBar 实例源码
项目:can4eve
文件:JavaFXDisplay.java
/**
* show or hide the menuBar
*
* @param scene
* @param pMenuBar
*/
public void showMenuBar(Scene scene, MenuBar pMenuBar, boolean show) {
Parent sroot = scene.getRoot();
ObservableList<Node> rootChilds = null;
if (sroot instanceof VBox)
rootChilds = ((VBox) sroot).getChildren();
if (rootChilds == null)
throw new RuntimeException(
"showMenuBar can not handle scene root of type "
+ sroot.getClass().getName());
if (!show && rootChilds.contains(pMenuBar)) {
rootChilds.remove(pMenuBar);
} else if (show) {
rootChilds.add(0, pMenuBar);
}
pMenuBar.setVisible(show);
hideMenuButton
.setText(show ? I18n.get(I18n.HIDE_MENU) : I18n.get(I18n.SHOW_MENU));
}
项目:Vokabeltrainer
文件:Main.java
@Override
public void start(Stage stage) {
stage.setTitle("Vokabeltrainer");
Scene scene = new Scene(new VBox(), 400, 350);
scene.setFill(Color.OLDLACE);
MenuBar menuBar = new MenuBar();
// --- Menu File
Menu menuFile = new Menu("Vokabeln");
MenuItem sample = new MenuItem("Sample");
sample.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// Do stuff here
}
});
menuFile.getItems().add(sample);
// --- Menu Edit
Menu menuEdit = new Menu("Abfragemodus");
// --- Menu View
Menu menuView = new Menu("Statistik");
menuBar.getMenus().addAll(menuFile, menuEdit, menuView);
((VBox) scene.getRoot()).getChildren().addAll(menuBar);
stage.setScene(scene);
stage.show();
}
项目:marathonv5
文件:JavaFXMenuBarElement.java
@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;
}
项目:atbash-octopus
文件:ApplicationMenu.java
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);
}
项目:erp-frontend
文件:DefaultMenuManager.java
protected void parseMenu (Stage stage, MenuBar menuBar, JsonArray jsonArray) {
Platform.runLater(() -> {
for (int i = 0; i < jsonArray.size(); i++) {
//get menu entry
JsonObject entry = jsonArray.getJsonObject(i);
//get event and title
//String event = entry.getString("event");
String title = entry.getString("title");
//create new menu
Menu menu = new Menu(title);
//add sub menus
this.parseSubMenus(menu, entry.getJsonArray("submenus"));
//add menu to menu bar
menuBar.getMenus().add(menu);
}
menuBar.prefWidthProperty().bind(stage.widthProperty());
});
}
项目:WebPLP
文件:PLPToolMenuBarPanel.java
public PLPToolMenuBarPanel(Controller controller)
{
this.controller = controller;
MenuBar menuBar = new MenuBar();
Menu file = createFileMenu();
Menu edit = createEditMenu();
Menu view = createViewMenu();
Menu project = createProjectMenu();
Menu tools = createToolsMenu();
Menu simulation = createSimulationMenu();
Menu help = createHelpMenu();
menuBar.getMenus().addAll(file, edit, view, project, tools, simulation, help);
this.setCenter(menuBar);
}
项目:GazePlay
文件:Utils.java
public static MenuBar buildLicence() {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
String licenseFileAsString = loadLicenseFileAsString(classLoader);
MenuItem licenseMenuItem = new MenuItem(licenseFileAsString);
Menu menu = new Menu("GazePlay");
menu.getItems().add(licenseMenuItem);
MenuBar menuBar = new MenuBar();
menuBar.getMenus().addAll(menu);
menuBar.setPrefHeight(40);
menuBar.setPrefWidth(80);
return menuBar;
}
项目:can4eve
文件:JavaFXDisplay.java
/**
* create the Menu Bar
*
* @param scene
*/
public MenuBar createMenuBar(Scene scene, com.bitplan.gui.App app) {
MenuBar lMenuBar = new MenuBar();
for (com.bitplan.gui.Menu amenu : app.getMainMenu().getSubMenus()) {
Menu menu = new Menu(i18n(amenu.getId()));
lMenuBar.getMenus().add(menu);
for (com.bitplan.gui.MenuItem amenuitem : amenu.getMenuItems()) {
MenuItem menuItem = new MenuItem(i18n(amenuitem.getId()));
menuItem.setOnAction(this);
menuItem.setId(amenuitem.getId());
menu.getItems().add(menuItem);
}
}
hideMenuButton = new Button(I18n.get(I18n.HIDE_MENU));
hideMenuButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
showMenuBar(scene, lMenuBar, !lMenuBar.isVisible());
}
});
return lMenuBar;
}
项目:Gargoyle
文件:SqlTabPanExample.java
@Override
public void start(Stage primaryStage) throws NotYetSupportException, GargoyleConnectionFailException, InstantiationException, IllegalAccessException, ClassNotFoundException {
primaryStage.setTitle("Database Exam");
CommonsSqllPan sqlPane = CommonsSqllPan.getSqlPane();
sqlPane.getStylesheets().add(SkinManager.getInstance().getSkin());
BorderPane root = new BorderPane(sqlPane);
Menu menu = new Menu("Exam");
MenuItem e = new MenuItem("exam");
e.setOnAction(System.out::println);
e.setAccelerator(new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN));
menu.getItems().add(e);
root.setTop(new MenuBar(menu));
primaryStage.setScene(new Scene(root, 1100, 700));
primaryStage.show();
// Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
// DockPane.initializeDefaultUserAgentStylesheet();
}
项目:openjfx-8u-dev-tests
文件:MenuMnemonicsApp.java
public MnemonicsScene() {
super(box, 600, 400);
Utils.addBrowser(this);
final MenuBar bar = new MenuBar();
generateMenus(bar.getMenus(), 2, 2, 0);
CheckBox check = new CheckBox("setMnemonicParse()");
check.setSelected(true);
check.setId(CHECK_MENU_PARSE_ID);
check.selectedProperty().addListener(new ChangeListener<Boolean>() {
public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
setMnemocicParse((ObservableList)bar.getMenus(), t1);
}
});
box.getChildren().addAll(bar, check);
}
项目:openjfx-8u-dev-tests
文件:DragDropWithControlsBase.java
protected void dnd() throws InterruptedException {
sceneSource.mouse().click(1, new Point(0, 0));
Wrap from = Lookups.byID(sceneSource, ID_DRAG_SOURCE, Node.class);
Wrap to = Lookups.byID(sceneTarget, ID_DRAG_TARGET, Node.class);
Point fromPoint = from.getClickPoint();
Point toPoint = to.getClickPoint();
final Object fromControl = from.getControl();
if (fromControl instanceof MenuBar || fromControl instanceof ToolBar
|| fromControl instanceof ScrollPane || fromControl instanceof Pagination) {
fromPoint = new Point(2, 2);
}
if (fromControl instanceof TitledPane) {
fromPoint = new Point(5, 30);
}
final Object toControl = to.getControl();
if (toControl instanceof MenuBar || toControl instanceof ToolBar
|| toControl instanceof ScrollPane || toControl instanceof Pagination) {
toPoint = new Point(2, 2);
}
if (toControl instanceof TitledPane) {
toPoint = new Point(30, 30);
}
dnd(from, fromPoint, to, toPoint);
}
项目:openjfx-8u-dev-tests
文件:MenuTest.java
@BeforeClass
public static void setUpClass() throws Exception {
MenuApp.main(null);
scene = Root.ROOT.lookup().wrap();
sceneAsParent = scene.as(Parent.class, Node.class);
menuBar = (MenuBarWrap) sceneAsParent.lookup(MenuBar.class).wrap();
menu = (MenuWrap<? extends Menu>) menuBar.as(Parent.class, Menu.class).lookup().wrap();
menuAsParent = menu.as(Parent.class, MenuItem.class);
container = menuBar;
object = menu;
contentPane = sceneAsParent.lookup(new ByID<Node>(MenuApp.TEST_PANE_ID)).wrap();
clearBtn = sceneAsParent.lookup(new ByText(MenuApp.CLEAR_BTN_ID)).wrap();
resetBtn = sceneAsParent.lookup(new ByText(MenuApp.RESET_BTN_ID)).wrap();
addPosBtn = sceneAsParent.lookup(new ByText(MenuApp.ADD_SINGLE_AT_POS_BTN_ID)).wrap();
removePosBtn = sceneAsParent.lookup(new ByText(MenuApp.REMOVE_SINGLE_AT_POS_BTN_ID)).wrap();
check = (Wrap<? extends Label>) sceneAsParent.lookup(new ByID(MenuApp.LAST_SELECTED_ID)).wrap();
hidden = sceneAsParent.lookup(CheckBox.class, new ByID<CheckBox>(MenuApp.SHOWN_CHECK_ID)).wrap();
hiding = sceneAsParent.lookup(CheckBox.class, new ByID<CheckBox>(MenuApp.SHOWING_CHECK_ID)).wrap();
}
项目:openjfx-8u-dev-tests
文件:MenuItemTest.java
@BeforeClass
public static void setUpClass() throws Exception {
MenuItemApp.main(null);
scene = Root.ROOT.lookup().wrap();
sceneAsParent = scene.as(Parent.class, Node.class);
menuBar = sceneAsParent.lookup(MenuBar.class).wrap();
menuBarAsParent = menuBar.as(Parent.class, Menu.class);
menuBarLookup = menuBarAsParent.lookup(Menu.class, new LookupCriteria<Menu>() {
public boolean check(Menu control) {
return control.getParentMenu() == null;
}
});
menuAsMenuOwner = menuBar.as(MenuOwner.class, Menu.class);
contentPane = sceneAsParent.lookup(new ByID<Node>(MenuItemApp.TEST_PANE_ID)).wrap();
clearLastSelectedBtn = sceneAsParent.lookup(new ByText(MenuItemApp.LAST_PRESSED_CLEAR_BTN_ID)).wrap();
clearLastEventBtn = sceneAsParent.lookup(new ByText(MenuItemApp.LAST_EVENT_CLEAR_BTN_ID)).wrap();
disableBtn = sceneAsParent.lookup(CheckBox.class, new ByText(MenuItemApp.DISABLE_CB_ID)).wrap();
eventBtn = sceneAsParent.lookup(CheckBox.class, new ByText(MenuItemApp.EVENT_CB_ID)).wrap();
hideBtn = sceneAsParent.lookup(CheckBox.class, new ByText(MenuItemApp.HIDE_CB_ID)).wrap();
lastSelected = sceneAsParent.lookup(new ByID(MenuItemApp.LAST_PRESSED_ID)).wrap();
lastEvent = sceneAsParent.lookup(new ByID(MenuItemApp.LAST_EVENT_ID)).wrap();
}
项目:openjfx-8u-dev-tests
文件:staticPropertyLoadApp.java
@Override
public Node impl_drawNode() throws IOException {
Menu uplevelNode = null;
FXMLLoader fxmlLoader = new FXMLLoader(resource);
try {
uplevelNode = (Menu)fxmlLoader.load();
} catch (Exception e) {
System.out.println("message: " + e.getMessage());
reportGetterFailure("message: " + e.getMessage());
ParseTraceElement ptes[] = fxmlLoader.impl_getParseTrace();
for (ParseTraceElement pte: ptes) {
// see rt-19329
System.out.println("trace element: " + pte);
}
}
MenuBar mb = new MenuBar();
mb.getMenus().add(uplevelNode);
// debug: uplevelNode.getItems().add(new MenuItem("open!!"));
return mb;
}
项目:HTMLEditor
文件:MenuBuilder.java
public MenuBar buildMenuBarWithMenus(HTMLEditor editor, final ReadOnlyDoubleProperty menuWidthProperty, String STYLE_CSS){
MenuBar menuBar = new MenuBar();
menuBar.setStyle(STYLE_CSS);
// Add File menu to menu bar
menuBar.getMenus().add(new FileMenuBuilder().getProduct(editor));
//Add Edit menu to menu bar
menuBar.getMenus().add(new EditMenuBuilder().getProduct(editor)) ;
//Add Insert menu to menu bar
menuBar.getMenus().add(new InsertMenuBuilder().getProduct(editor));
//Add Indent menu to menu bar
menuBar.getMenus().add(new IndentMenuBuilder().getProduct(editor));
// Add View menu to menu bar
menuBar.getMenus().add(new ViewMenuBuilder().getProduct(editor));
// bind width of menu bar to width of associated stage
menuBar.prefWidthProperty().bind(menuWidthProperty);
return menuBar;
}
项目:mars-sim
文件:AboutMenu.java
@Override public void start(Stage primaryStage) throws Exception {
primaryStage.setScene(new Scene(new StackPane()));
primaryStage.show();
MenuToolkit tk = MenuToolkit.toolkit();
AboutStageBuilder aboutStageBuilder = AboutStageBuilder.start("About MyApp")
.withAppName("MyApp").withCloseOnFocusLoss().withHtml("<i>Some descriptive text</i>")
.withVersionString("Version 1.0b").withCopyright("Copyright \u00A9 " + Calendar
.getInstance().get(Calendar.YEAR));
try {
IcnsParser parser = IcnsParser.forFile(AboutStageBuilder.DEFAULT_APP_ICON);
aboutStageBuilder = aboutStageBuilder.withImage(new Image(parser.getIconStream(IcnsType.ic08)));
} catch (IOException e) {
// Too bad, cannot load dummy image
}
Menu applicationMenu = tk.createDefaultApplicationMenu("MyApp", aboutStageBuilder.build());
MenuBar bar = new MenuBar();
bar.getMenus().add(applicationMenu);
tk.setMenuBar(bar);
}
项目:NSMenuFX
文件:AboutMenu.java
@Override public void start(Stage primaryStage) throws Exception {
primaryStage.setScene(new Scene(new StackPane()));
primaryStage.show();
MenuToolkit tk = MenuToolkit.toolkit();
AboutStageBuilder aboutStageBuilder = AboutStageBuilder.start("About MyApp")
.withAppName("MyApp").withCloseOnFocusLoss().withHtml("<i>Some descriptive text</i>")
.withVersionString("Version 1.0b").withCopyright("Copyright \u00A9 " + Calendar
.getInstance().get(Calendar.YEAR));
try {
IcnsParser parser = IcnsParser.forFile(AboutStageBuilder.DEFAULT_APP_ICON);
aboutStageBuilder = aboutStageBuilder.withImage(new Image(parser.getIconStream(IcnsType.ic08)));
} catch (IOException e) {
// Too bad, cannot load dummy image
}
Menu applicationMenu = tk.createDefaultApplicationMenu("MyApp", aboutStageBuilder.build());
MenuBar bar = new MenuBar();
bar.getMenus().add(applicationMenu);
tk.setMenuBar(bar);
}
项目:NSMenuFX
文件:JavaFXDefault.java
@Override
public void start(Stage primaryStage) throws Exception {
MenuToolkit tk = MenuToolkit.toolkit(Locale.getDefault());
tk.setApplicationMenu(tk.createDefaultApplicationMenu("test"));
MenuBar menuBar = new MenuBar();
menuBar.useSystemMenuBarProperty().set(true);
Menu menu = new Menu("java");
MenuItem item = new MenuItem("Test");
Menu help = new Menu("Help");
menu.getItems().add(item);
menuBar.getMenus().addAll(menu, help);
primaryStage.setScene(new Scene(new Pane(menuBar)));
primaryStage.setTitle("Test");
primaryStage.show();
}
项目:Equi
文件:MainPanel.java
public MainPanel(Stage owner) {
GraphListPanel panel = new GraphListPanel();
panel.setGraphProcessor(graph -> processSelectedGraph(graph, owner));
MenuBar menuBar = new MenuBar();
Menu fileMenu = new Menu("_File");
fileMenu.getItems().addAll(
panel.createMenuItemOpen(owner),
new SeparatorMenuItem(),
createMenuItemExit()
);
menuBar.getMenus().addAll(fileMenu);
setTop(menuBar);
setCenter(panel);
}
项目:VOOGASalad
文件:SpriteMovement.java
private Pane makePopUpPane(String movementType, Stage stage){
VBox smallPane=new VBox();
smallPane.setStyle("-fx-background-color: BLACK");
Label movementLabel=new Label(" Pick the Key for the Movement");
movementLabel.setPrefSize(290, 70);
movementLabel.setTextAlignment(TextAlignment.CENTER);
//movementLabel.relocate(0, 0);
movementLabel.getStylesheets().add("./com/print_stack_trace/voogasalad/controller/guiResources/SpritePane.css");
movementLabel.getStyleClass().add("keylabel1");
MenuBar moveMentFunction=new MenuBar();
//moveMentFunction.relocate(0, 70);
moveMentFunction.setPrefWidth(290);
moveMentFunction.setPrefHeight(75);
moveMentFunction.getStylesheets().add("./com/print_stack_trace/voogasalad/controller/guiResources/SpritePane.css");
Menu myMovement=new Menu("Key Options");
addKeyMenus(movementType, myMovement, stage);
moveMentFunction.getMenus().addAll(myMovement);
smallPane.getChildren().addAll(movementLabel, moveMentFunction);
return smallPane;
}
项目:VOOGASalad
文件:MessagePopUp.java
public String showDropDownDialog(String message, String[] options){
MenuBar bar=new MenuBar();
bar.relocate(0, height/2);
bar.setPrefSize(width/1.3, height/5);
Menu menuName=new Menu("Please Pick One");
for (int i=0; i<options.length; i++){
MenuItem item=new MenuItem(options[i]);
item.setOnAction(e->{
dropDownString=item.getText();
close();
});
menuName.getItems().add(item);
}
bar.getMenus().add(menuName);
add(bar);
makeMessage(message);
showStage();
return dropDownString;
}
项目:LJGM
文件:LJGM.java
/**
* Creates the menu bar.
*
* @return the menu bar
*/
private MenuBar createMenuBar() {
MenuBar menuBar = new MenuBar();
Menu file = new Menu("File");
Menu about = new Menu("About");
MenuItem aboutProject = new MenuItem("About LJGM");
aboutProject.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
// show about dialog
}
});
about.getItems().add(aboutProject);
menuBar.getMenus().addAll(file, about);
return menuBar;
}
项目:lawless-legends
文件:UIAction.java
public static MenuBar buildMenu() {
MenuBar menu = new MenuBar();
Menu currentMenu = null;
for (final MAIN_ACTIONS action : UIAction.MAIN_ACTIONS.values()) {
if (action.name().startsWith("_")) {
if (currentMenu != null) {
menu.getMenus().add(currentMenu);
}
currentMenu = new Menu(action.name().replace("_", ""));
} else {
MenuItem item = new MenuItem(action.name().replaceAll("_", " "));
item.setOnAction((ActionEvent t) -> {
try {
actionPerformed(action);
} catch (IOException ex) {
Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex);
}
});
currentMenu.getItems().add(item);
}
}
menu.getMenus().add(currentMenu);
menu.setMinWidth(1.0);
return menu;
}
项目:Suji
文件:Main.java
private void buildMenuBar() {
//file menu, creating the main tabs
Menu fileMenu = getFileMenu();
Menu ogsMenu = getOGSMenu();
Menu settingsMenu = getSettingsMenu();
//main menu bar
menuBar = new MenuBar();
menuBar.getMenus().addAll(fileMenu, ogsMenu, settingsMenu);
}
项目:marathonv5
文件:RFXMenuItem.java
private boolean isMenuBar(Node ownerNode) {
Node parent = ownerNode;
while (parent != null) {
if (parent instanceof MenuBar) {
this.menuBar = (MenuBar) parent;
return true;
}
parent = parent.getParent();
}
return false;
}
项目:GameAuthoringEnvironment
文件:AuthoringView.java
private MenuBar createMenuBar () {
MenuBar menuBar = new MenuBar();
Menu fileMenu = new Menu(myLabel.getString("File"));
MenuItem goHome = createMenuItems(myLabel.getString("GoHome"), e -> goHome());
MenuItem saveItem = createMenuItems(myLabel.getString("Save"), e -> saveToXML());
MenuItem loadItem = createMenuItems(myLabel.getString("Load"), e -> loadGame());
MenuItem launchItem = createMenuItems(myLabel.getString("Launch"), e -> launchGame());
fileMenu.getItems().add(goHome);
fileMenu.getItems().add(saveItem);
fileMenu.getItems().add(loadItem);
fileMenu.getItems().add(launchItem);
menuBar.getMenus().add(fileMenu);
return menuBar;
}
项目:GameAuthoringEnvironment
文件:GameLibraryView.java
private void createMenuBar () {
MenuBar menuBar = new MenuBar();
Menu menu = new Menu(myLang.getString("File"));
myHomeItem = new MenuItem(myLang.getString("GoHome"));
myHomeItem.setOnAction(e -> new MainUserInterface().init(myStage));
menu.getItems().add(myHomeItem);
menuBar.getMenus().add(menu);
myLayout.setTop(menuBar);
}
项目:OftenPorter
文件:FXUIProvider.java
private void search(UIPlatform uiPlatform, Parent parent)
{
ObservableList<Node> list = parent.getChildrenUnmodifiable();
if (list.size() == 0)
{
return;
}
final String idPrefix = getPrefix().idPrefix;
final String pathPrefix = getPrefix().pathPrefix;
IdDeal idDeal = uiPlatform.getIdDeal();
BinderFactory factory = uiPlatform.getBinderFactory();
for (int i = 0; i < list.size(); i++)
{
Node node = list.get(i);
UiId id = UiId.newInstance(node.getId(), idPrefix);
if (id != null)
{
IdDeal.Result result = idDeal.dealId(id, pathPrefix);
if (result != null)
{
hashMap.put(id, factory.getBinder(node));
}
}
if (node instanceof Parent)
{
search(uiPlatform, (Parent) node);
}
if (node instanceof MenuBar)
{
search(uiPlatform, (MenuBar) node);
}
}
}
项目:OftenPorter
文件:FXUIProvider.java
/**
* 菜单栏的搜索
*
* @param uiPlatform
* @param menuBar
*/
private void search(UIPlatform uiPlatform, MenuBar menuBar)
{
ObservableList<Menu> list = menuBar.getMenus();
if (list.size() == 0)
{
return;
}
final String idPrefix = getPrefix().idPrefix;
final String pathPrefix = getPrefix().pathPrefix;
IdDeal idDeal = uiPlatform.getIdDeal();
BinderFactory factory = uiPlatform.getBinderFactory();
for (int i = 0; i < list.size(); i++)
{
Menu menu = list.get(i);
UiId id = UiId.newInstance(menu.getId(), idPrefix);
if (id != null)
{
IdDeal.Result result = idDeal.dealId(id, pathPrefix);
if (result != null)
{
hashMap.put(id, factory.getBinder(menu));
}
}
search(uiPlatform, menu);
}
}
项目:CalendarFX
文件:GoogleCalendarAppViewSkin.java
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;
}
项目:can4eve
文件:TestAppGUI.java
@Test
public void testTabIcons() throws Exception {
JavaFXDisplay display = super.getDisplay();
VBox vbox = new VBox();
display.setRoot(vbox);
SampleApp sampleApp = new SampleApp("menus", vbox);
sampleApp.show();
sampleApp.waitOpen();
display.setStage(sampleApp.getStage());
Platform.runLater(() -> {
MenuBar menuBar = display.createMenuBar(sampleApp.getScene(),
display.getApp());
display.setMenuBar(menuBar);
display.showMenuBar(sampleApp.getScene(), menuBar, true);
display.setUpStatusBar();
});
XYTabPane xyTabPane = display.getXyTabPane();
Platform.runLater(() -> {
display.setupXyTabPane();
display.setupDashBoard();
});
// xyTabPane.prefHeightProperty().bind(display.getStage().heightProperty());
display.getStage().heightProperty()
.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
if (xyTabPane != null)
System.out.println("oldh: " + oldValue.intValue() + " newh: "
+ newValue.intValue() + " xyh:" + xyTabPane.getPrefHeight()
+ " vth:" + xyTabPane.getvTabPane().getPrefHeight());
}
});
Thread.sleep(SHOW_TIME);
sampleApp.close();
}
项目:voogasalad-ltub
文件:LevelManager.java
/**
* show the Level MenuItem to the player
* The player can choose a level to start a game or choose a random game
*/
public void show(){
//Stage primaryStage = new Stage();
primaryStage.setTitle(TITLE);
Group root = new Group();
Menu level = initLevelMenu();
Menu setting = initSettingMenu();
Menu help = initHelpMenu();
menuBar = new MenuBar(level, setting, help);
root.getChildren().add(menuBar);
AnimationImage im = new AnimationImage();
Scene scene = new Scene(root);
Image image = new Image(getClass().getClassLoader().getResourceAsStream(myResources.getString("levelChoiceImagePath")));
scene.setFill(new ImagePattern(image));
scene.getStylesheets().setAll(CSS_LOCATION);
HBox hBox = new HBox();
hBox.getChildren().add(im.getImageView(SEED));
hBox.setLayoutX(300);
hBox.setLayoutY(200);
root.getChildren().add(hBox);
Button starting = createButton();
root.getChildren().add(starting);
primaryStage.setScene(scene);
primaryStage.setFullScreen(true);
primaryStage.setFullScreenExitHint("");
primaryStage.setFullScreenExitKeyCombination(null);
primaryStage.show();
}
项目:SkyHussars
文件:EditorView.java
public MenuBar menubar(PlaneEd planeEd) {
MenuBar menuBar = new MenuBar();
Menu fileMenu = new Menu("File");
ObservableList<MenuItem> mis = fileMenu.getItems();
mis.add(loadMenu(planeEd));
mis.add(saveMenu(planeEd));
mis.add(saveAsMenu(planeEd));
menuBar.getMenus().add(fileMenu);
return menuBar;
}
项目:Gargoyle
文件:DesignerFx.java
private MenuBar createFxMenuBar() {
MenuBar menuBar = new MenuBar();
Menu menu = new Menu("Language");
ToggleGroup group = new ToggleGroup();
LanguageVersion[] languageVersions = getSupportedLanguageVersions();
for (int i = 0; i < languageVersions.length; i++) {
LanguageVersion languageVersion = languageVersions[i];
// JRadioButtonMenuItem button = new JRadioButtonMenuItem(languageVersion.getShortName());
RadioMenuItem button = new RadioMenuItem(languageVersion.getShortName());
button.setToggleGroup(group);
languageVersionMenuItems[i] = button;
// group.add(button);
menu.getItems().add(button);
}
// languageVersionMenuItems[DEFAULT_LANGUAGE_VERSION_SELECTION_INDEX].setSelected(true);
languageVersionMenuItems[getDefaultLanguageVersionSelectionIndex()].setSelected(true);
menuBar.getMenus().add(menu);
Menu actionsMenu = new Menu("Actions");
MenuItem copyXMLItem = new MenuItem("Copy xml to clipboard");
copyXMLItem.setOnAction(e -> copyXmlToClipboard());
actionsMenu.getItems().add(copyXMLItem);
MenuItem createRuleXMLItem = new MenuItem("Create rule XML");
createRuleXMLItem.setOnAction(e -> createRuleXML());
actionsMenu.getItems().add(createRuleXMLItem);
menuBar.getMenus().add(actionsMenu);
return menuBar;
}
项目:gralog
文件:MainMenu.java
MainMenu(Handlers handlers) {
this.handlers = handlers;
menu = new MenuBar();
menu.getMenus().addAll(
createFileMenu(),
createEditMenu(),
createAlgorithmMenu(),
createHelpMenu());
updateStructures();
updateGenerators();
}
项目:zunozap
文件:ZunoZapWebView.java
@Override
public void start(Stage stage, Scene scene, StackPane root, BorderPane border) throws Exception {
OptionMenu.init();
tb = new TabPane();
menuBar = new MenuBar();
bmread = new Reader(menuBook);
bmread.refresh();
mkDirs(home, saveDir, temp, cssDir);
stage.getIcons().add(new Image(ZunoZap.class.getClassLoader().getResourceAsStream("zunozaplogo.gif")));
tb.setPrefSize(1365, 768);
tb.setSide(Side.TOP);
/// Setup tabs
Tab newtab = new Tab(" + ");
newtab.setClosable(false);
tb.getTabs().add(newtab);
createTab(true);
tb.getSelectionModel().selectedItemProperty().addListener((a,b,c) -> { if (c == newtab) createTab(false); });
border.setCenter(tb);
border.setTop(menuBar);
border.autosize();
WebView dummy = new WebView();
setUserAgent(dummy.getEngine());
regMenuItems(bmread, menuFile, menuBook, aboutPageHTML("Java WebView", dummy.getEngine().getUserAgent(), "ZunoZap/zunozap/master/LICENCE", "LGPLv3", "N/A"), tb, Engine.WEBKIT);
menuBar.getMenus().addAll(menuFile, menuBook);
sm = new StyleManager(cssDir, scene);
scene.getStylesheets().add(ZunoAPI.stylesheet.toURI().toURL().toExternalForm());
p.loadPlugins();
if (allowPluginEvents()) for (PluginBase pl : p.plugins) pl.onLoad(stage, scene, tb);
}
项目:myWMS
文件:MyWMS.java
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;
}
项目:JGitFX
文件:TextEditorWithGit.java
@Override
public void start(Stage primaryStage) {
stage = primaryStage;
/*
BorderPane {
Top {
MenuBar {
File {
Exit - closes program
}
Git {
// code yet to be implemented
}
}
}
Center {
TextArea - the plaintext Text editor
}
}
*/
area = new TextArea();
// set up MenuBar, its Menus, and
Menu fileMenu = initFileMenu();
Menu gitMenu = initGitMenu(primaryStage);
MenuBar menuBar = new MenuBar(fileMenu, gitMenu);
root.setTop(menuBar);
root.setCenter(area);
root.setBottom(scrollPane);
Scene scene = new Scene(root, 800, 800);
primaryStage.setScene(scene);
primaryStage.show();
}
项目:MineIDE-UI
文件:GuiActionBar.java
public static void init(Scene scene)
{
MenuBar menuBar = new MenuBar();
SpecificClasses.initSubClasses();
menuBar.getMenus().addAll(createFileMenu(), createEditMenu(), createForgeMenu(), createOptionMenu(),
createMinecraftMenu(), createRunMenu(), createHelpMenu());
((VBox) scene.getRoot()).getChildren().addAll(menuBar);
}
项目:openjfx-8u-dev-tests
文件:MenuBarTest.java
@BeforeClass
public static void setUpClass() throws Exception {
MenuBarApp.main(null);
scene = Root.ROOT.lookup().wrap();
sceneAsParent = scene.as(Parent.class, Node.class);
menuBar = sceneAsParent.lookup(MenuBar.class).wrap();
container = menuBar;
object = menuBar;
menuAsStringMenuOwner = menuBar.as(StringMenuOwner.class, Menu.class);
menuAsParent = menuBar.as(Parent.class, Menu.class);
contentPane = sceneAsParent.lookup(new ByID<Node>(MenuBarApp.TEST_PANE_ID)).wrap();
clearBtn = sceneAsParent.lookup(new ByText(MenuBarApp.CLEAR_BTN_ID)).wrap();
resetBtn = sceneAsParent.lookup(new ByText(MenuBarApp.RESET_BTN_ID)).wrap();
}