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


Java MenuButton类代码示例

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


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

示例1: start

import javafx.scene.control.MenuButton; //导入依赖的package包/类
public void start(Stage primaryStage) throws Exception {
	
	//Essa parte foi para apenas escrever algo no arquivo de disciplinas, para testar.
	//se a parte disciplina aptas da GUI estava certa.
	//Disciplina dis = new Disciplina("�lgebra ", 23);
	//DisciplinaController.getInstance().cadastrarDisciplina(dis);
	//.........................
	primaryStage.setTitle("Cadastro de Professores");
	pane = FXMLLoader.load(this.getClass().getResource("cadastroProfessorFXML.fxml"));
	menu = (MenuButton) pane.getChildren().get(8);
	adiciona();
	primaryStage.setScene(new Scene(pane));
	primaryStage.setResizable(false);
	primaryStage.show();
	
}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:17,代码来源:CadastroProfessor.java

示例2: getConstructorPage

import javafx.scene.control.MenuButton; //导入依赖的package包/类
@Override
protected List<Labeled> getConstructorPage() {
    List<Labeled> list = new ArrayList<Labeled>();

    MenuButton default_button = new MenuButton(DEFAULT_BUTTON);
    defaultLayout.apply(default_button);
    if (!default_button.getText().equals(DEFAULT_BUTTON)) {
        reportGetterFailure("new MenuButton(DEFAULT_LABEL)");
    } else {
        list.add(default_button);
    }

    Rectangle rectangle = new Rectangle(10, 10, Color.rgb(200, 100, 100));
    MenuButton graphic_button = new MenuButton(GRAPHICS_BUTTON, rectangle);
    defaultLayout.apply(graphic_button);
    if (!graphic_button.getText().equals(GRAPHICS_BUTTON) || graphic_button.getGraphic() != rectangle) {
        reportGetterFailure("new MenuButton(GRAPHICS_LABEL, rectangle)");
    } else {
        list.add(graphic_button);
    }
    return list;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:MenuButtonsApp.java

示例3: setUpVars

import javafx.scene.control.MenuButton; //导入依赖的package包/类
public static void setUpVars() throws Exception {
    scene = Root.ROOT.lookup().wrap();
    sceneAsParent = scene.as(Parent.class, Node.class);
    object = container = (MenuButtonWrap) sceneAsParent.lookup(new LookupCriteria<Node>() {
        public boolean check(Node cntrl) {
            return MenuButton.class.isAssignableFrom(cntrl.getClass());
        }
    }).wrap();
    contentPane = sceneAsParent.lookup(new ByID<Node>(MenuButtonApp.TEST_PANE_ID)).wrap();
    clearBtn = sceneAsParent.lookup(new ByText(MenuButtonApp.CLEAR_BTN_ID)).wrap();
    resetBtn = sceneAsParent.lookup(new ByText(MenuButtonApp.RESET_BTN_ID)).wrap();
    addPosBtn = sceneAsParent.lookup(new ByText(MenuButtonApp.ADD_SINGLE_AT_POS_BTN_ID)).wrap();
    removePosBtn = sceneAsParent.lookup(new ByText(MenuButtonApp.REMOVE_SINGLE_AT_POS_BTN_ID)).wrap();
    check = (Wrap<? extends Label>) sceneAsParent.lookup(new ByID(MenuButtonApp.LAST_SELECTED_ID)).wrap();
    sideCB = sceneAsParent.lookup(ChoiceBox.class).wrap();
    menuButtonAsStringMenuOwner = container.as(StringMenuOwner.class, Menu.class);
    menuButtonAsParent = container.as(Parent.class, MenuItem.class);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:19,代码来源:MenuButtonTest.java

示例4: expand

import javafx.scene.control.MenuButton; //导入依赖的package包/类
/**
 * Sleeps are applied in this method, because of RT-28683. We need to wait,
 * until a popup is really shown, but cannot determine that, in JFX.
 */
private void expand(final Menu menu) {
    if (!MenuWrap.isShowing(menu, getEnvironment())) {
        final Menu parent = getParentMenu(menu);
        if (parent != null) {
            expand(parent);
            getEnvironment().getTimeout(BEFORE_CLICK_TO_EXPAND_SLEEP).sleep();
            waitState(() -> MenuWrap.isParentShown(menu, getEnvironment()), true);
        }
        Wrap<? extends Node> mWrap = findWrap(menu);
        if (mWrap.getControl() instanceof MenuButton) {
            mWrap.mouse().move();
            getEnvironment().getTimeout(BEFORE_CLICK_TO_EXPAND_SLEEP).sleep();
            if (!MenuWrap.isShowing(menu, getEnvironment())) {
                mWrap.mouse().click();
            }
        } else {
            mWrap.mouse().move();
            getEnvironment().getTimeout(BEFORE_CLICK_TO_EXPAND_SLEEP).sleep();
        }
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:MenuItemWrap.java

示例5: start

import javafx.scene.control.MenuButton; //导入依赖的package包/类
@Override
public void start(final Stage stage)
{
    final MenuButton button1 = new MenuButton("Plain Button", null, new MenuItem("Item 1"), new MenuItem("Item 2"));
    button1.getStyleClass().add("action_button");

    final MenuItem item = new MenuItem("Action Button Item");
    item.getStyleClass().add("action_button_item");
    final MenuButton button2 = new MenuButton("Dark Button", null, item, new MenuItem("Plain Item"));

    button2.setStyle(JFXUtil.shadedStyle(new WidgetColor(100, 0, 0)));
    button2.setTextFill(Color.YELLOW);
    button2.getStyleClass().add("action_button");

    final HBox box = new HBox(button1, button2);

    final Scene scene = new Scene(box, 800, 700);
    // XXX Enable scenic view to debug styles
    // ScenicView.show(scene);
    JFXRepresentation.setSceneStyle(scene);
    stage.setScene(scene);
    stage.setTitle("MenuButtons");

    stage.show();
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:26,代码来源:MenuButtonDemo.java

示例6: start

import javafx.scene.control.MenuButton; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	Group root = new Group();
	MenuButton btnList = new MenuButton();
	MenuItem item = new MenuItem("Testing");
	item.getStyleClass().add("myMenuItem");
	btnList.getItems().add(item);

	root.getChildren().add(btnList);
	Scene scene = new Scene(root, 500, 500, Color.LINEN);
	stage.setWidth(500);
    stage.setHeight(500);
    stage.setTitle("JavaFx Custom CSS For MenuItem Demo");
	stage.setScene(scene);
	stage.show();
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:17,代码来源:CustomCSSForMenuItem.java

示例7: NavigationButtons

import javafx.scene.control.MenuButton; //导入依赖的package包/类
/**
 * Constructor. This will prepare the buttons, which can then be retrieved
 * with {@link #getBackButton()}, {@link #getForwardButton()} and
 * {@link #getMenuButton()}.
 *
 * @param viewer
 *            The viewer to which the buttons will belong
 */
public NavigationButtons(TimeGraphWidget viewer) {
    List<NavigationMode> navModes = NAVIGATION_MODES;
    NavigationMode initialMode = navModes.get(0);

    BackButton backButton = new BackButton(viewer, initialMode);
    ForwardButton forwardButton = new ForwardButton(viewer, initialMode);
    MenuButton menuButton = new MenuButton();

    ToggleGroup tg = new ToggleGroup();
    List<RadioMenuItem> items = NAVIGATION_MODES.stream()
            .map(nm -> {
                RadioMenuItem item = new RadioMenuItem();
                item.setText(nm.getModeName());
                item.setGraphic(new HBox(new ImageView(nm.getBackIcon()), new ImageView(nm.getForwardIcon())));
                item.setToggleGroup(tg);
                item.setOnAction(e -> {
                    backButton.setNavMode(nm);
                    forwardButton.setNavMode(nm);
                });
                item.setDisable(!nm.isEnabled());
                return item;
            })
            .collect(Collectors.toList());

    items.get(0).setSelected(true);
    menuButton.getItems().addAll(items);

    fBackButton = backButton;
    fForwardButton = forwardButton;
    fMenuButton = menuButton;
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:40,代码来源:NavigationButtons.java

示例8: createToolBars

import javafx.scene.control.MenuButton; //导入依赖的package包/类
private void createToolBars(ToolBarPanel toolBarPanel) {
    VLToolBar infoToolBar = new VLToolBar();
    infoButton = new MenuButton(null, FXUIUtils.getIcon("info"));
    infoButton.setDisable(true);
    infoToolBar.add(infoButton);
    toolBarPanel.add(infoToolBar);
    VLToolBar clipboardToolBar = new VLToolBar();
    cutButton = FXUIUtils.createButton("cut", "Remove selected text and copy to clipboard");
    cutButton.setOnAction((event) -> cut());
    clipboardToolBar.add(cutButton);
    copyButton = FXUIUtils.createButton("copy", "Copy selected text to clipboard");
    copyButton.setOnAction((event) -> copy());
    clipboardToolBar.add(copyButton);
    pasteButton = FXUIUtils.createButton("paste", "Paste text from clipboard");
    pasteButton.setOnAction((event) -> paste());
    clipboardToolBar.add(pasteButton);
    toolBarPanel.add(clipboardToolBar);
    VLToolBar redoToolBar = new VLToolBar();
    undoButton = FXUIUtils.createButton("undo", "Undo last action");
    undoButton.setOnAction((event) -> editorExecuteProc("undo"));
    redoToolBar.add(undoButton);
    redoButton = FXUIUtils.createButton("redo", "Redo last undone action");
    redoButton.setOnAction((event) -> editorExecuteProc("redo"));
    redoToolBar.add(redoButton);
    toolBarPanel.add(redoToolBar);
    VLToolBar searchToolBar = new VLToolBar();
    Button search = FXUIUtils.createButton("search", "Search for a pattern", true);
    search.setOnAction((event) -> editorExecuteProc("find"));
    searchToolBar.add(search);
    Button replace = FXUIUtils.createButton("replace", "Search for a pattern and replace", true);
    replace.setOnAction((event) -> editorExecuteProc("replace"));
    searchToolBar.add(replace);
    toolBarPanel.add(searchToolBar);
    VLToolBar settingsToolBar = new VLToolBar();
    Button settingsButton = FXUIUtils.createButton("settings", "Modify editor settings", true);
    settingsButton.setOnAction((event) -> onSettings());
    settingsToolBar.add(settingsButton);
    toolBarPanel.add(settingsToolBar);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:40,代码来源:ACEEditor.java

示例9: start

import javafx.scene.control.MenuButton; //导入依赖的package包/类
public void start (Stage primaryStage) throws Exception{
	window = primaryStage;
	window.setTitle("Remover Disciplina");
	pane = FXMLLoader.load(this.getClass().getResource("removerDisciplinaFXML.fxml"));
	TextArea texto = (TextArea) pane.getChildren().get(4);
	menu2 = (MenuButton) pane.getChildren().get(9);
	nome = (TextField) pane.getChildren().get(2);
	id = (TextField) pane.getChildren().get(7);
	adiciona();
	texto.setEditable(false);
	window.setScene(new Scene(pane));
	window.setResizable(false);
	window.show();

}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:16,代码来源:RemoverDisciplina.java

示例10: start

import javafx.scene.control.MenuButton; //导入依赖的package包/类
public void start(Stage primaryStage) throws IOException {
	window = primaryStage;
	window.setTitle("Atualiza��o de Professor");
	window.setResizable(false);
	Pane pane = FXMLLoader.load(this.getClass().getResource("atualizarDisciplinaFXML.fxml"));
	menu2 = (MenuButton)pane.getChildren().get(10);
	id = (TextField)pane.getChildren().get(2);
	nome = (TextField)pane.getChildren().get(6);
	adiciona();
	window.setScene(new Scene(pane));
	window.show();
}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:13,代码来源:AtualizarDisciplina.java

示例11: start

import javafx.scene.control.MenuButton; //导入依赖的package包/类
public void start(Stage primaryStage) throws IOException {
	window = primaryStage;
	window.setTitle("Atualiza��o de Professor");
	window.setResizable(false);
	pane = FXMLLoader.load(this.getClass().getResource("AtualizarProfessorFXML.fxml"));
	menu1 = (MenuButton)pane.getChildren().get(10);
	menu2 = (MenuButton)pane.getChildren().get(11);
	adiciona();
	window.setScene(new Scene(pane));
	window.show();
}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:12,代码来源:AtualizarProfessor.java

示例12: start

import javafx.scene.control.MenuButton; //导入依赖的package包/类
public void start (Stage primaryStage) throws Exception{
	window = primaryStage;
	window.setTitle("Procurar Professor");
	pane = FXMLLoader.load(this.getClass().getResource("procurarDisciplinaFXML.fxml"));
	TextArea texto = (TextArea) pane.getChildren().get(4);
	menu2 = (MenuButton) pane.getChildren().get(9);
	um = (TextField) pane.getChildren().get(2);
	dois = (TextField) pane.getChildren().get(6);
	adiciona();
	texto.setEditable(false);
	window.setScene(new Scene(pane));
	window.setResizable(false);
	window.show();

}
 
开发者ID:omniplatypus,项目名称:Projeto-IP2,代码行数:16,代码来源:ProcurarDisciplina.java

示例13: getScene

import javafx.scene.control.MenuButton; //导入依赖的package包/类
@Override
protected Scene getScene() {
    return new LabeledsApp.LabeledScene() {

        @Override
        protected Labeled getTestedLabeled() {
            return new MenuButton();
        }
    };
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:11,代码来源:MenuButtonApp.java

示例14: show

import javafx.scene.control.MenuButton; //导入依赖的package包/类
protected void show() {
    new GetAction() {
        @Override
        public void run(Object... parameters) {
            ((MenuButton) container.getControl()).show();
        }
    }.dispatch(Root.ROOT.getEnvironment());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:9,代码来源:MenuButtonTest.java

示例15: hide

import javafx.scene.control.MenuButton; //导入依赖的package包/类
protected void hide() {
    new GetAction() {
        @Override
        public void run(Object... parameters) {
            ((MenuButton) container.getControl()).hide();
        }
    }.dispatch(Root.ROOT.getEnvironment());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:9,代码来源:MenuButtonTest.java


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