Search in sources :

Example 21 with MenuItem

use of javafx.scene.control.MenuItem in project Gargoyle by callakrsos.

the class JavaCodeAreaHelper method createMenus.

/**
	 * 메뉴 생성
	 * @작성자 : KYJ
	 * @작성일 : 2016. 10. 6.
	 */
@Override
public void createMenus() {
    super.createMenus();
    menuPmd = new Menu("PMD");
    menuRunPmd = new MenuItem("Run PMD");
    menuAutoComment = new MenuItem("Auto Comment");
    menuRunPmd.setOnAction(this);
    menuAutoComment.setOnAction(this);
    menuPmd.getItems().addAll(menuRunPmd);
    codeArea.getContextMenu().getItems().addAll(menuPmd, new SeparatorMenuItem(), menuAutoComment);
}
Also used : MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) Menu(javafx.scene.control.Menu) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 22 with MenuItem

use of javafx.scene.control.MenuItem in project arquivoProject by fader-azevedo.

the class ListaDocumentoController method rightClik.

private ContextMenu rightClik(JFXButton button) {
    final ContextMenu contextMenu = new ContextMenu();
    MenuItem verDoc = new MenuItem("Ver Pauta");
    MaterialDesignIconView iconEye = new MaterialDesignIconView(MaterialDesignIcon.EYE, "20");
    verDoc.setGraphic(iconEye);
    contextMenu.getItems().addAll(verDoc);
    verDoc.setOnAction(e -> {
        try {
            System.out.println(button.getText());
            FXMLLoader loader = new FXMLLoader();
            loader.load(getClass().getResource("/view/PdfViewer.fxml").openStream());
            Parent parent = loader.getRoot();
            File pdfCaminho = new File("documentos/pautas/" + button.getText());
            PdfViewerController pdfController = loader.getController();
            pdfController.initialize();
            pdfController.loadFile(pdfCaminho.toString());
            final Stage dialog = new Stage();
            dialog.initModality(Modality.APPLICATION_MODAL);
            Scene dialogScene = new Scene(parent, 500, 620);
            dialog.setScene(dialogScene);
            dialog.setTitle(button.getText());
            dialog.setResizable(false);
            dialog.show();
        } catch (IOException ex) {
            Logger.getLogger(ListaDocumentoController.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    return contextMenu;
}
Also used : Parent(javafx.scene.Parent) Stage(javafx.stage.Stage) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) IOException(java.io.IOException) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) File(java.io.File) MaterialDesignIconView(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView)

Example 23 with MenuItem

use of javafx.scene.control.MenuItem in project Challenger4SysAdmins by fvarrui.

the class MenuBuilder method getMenu.

/**
 * @param itemSelected elemento que tengamos seleccionado.
 *
 * @return menu contextual correspondiente al tipo del objeto seleccionado.
 */
public static ContextMenu getMenu(TreeItem<Object> itemSelected) {
    ContextMenu contextMenu = new ContextMenu();
    ListProperty<MenuItem> menuItems = new SimpleListProperty<>(FXCollections.observableArrayList());
    if (itemSelected.getParent() == null) {
        menuItems.add(new MenuItem("A�adir Goal", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/mas-16x16.png"))));
        menuItems.add(new MenuItem("Eliminar Goal", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/menos-16x16.png"))));
        contextMenu.getItems().addAll(menuItems);
    } else {
        menuItems.add(new MenuItem("A�adir Test", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/mas-16x16.png"))));
        menuItems.add(new MenuItem("Eliminar Test", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/menos-16x16.png"))));
        contextMenu.getItems().addAll(menuItems);
    }
    return contextMenu;
}
Also used : SimpleListProperty(javafx.beans.property.SimpleListProperty) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Example 24 with MenuItem

use of javafx.scene.control.MenuItem in project Board-Instrumentation-Framework by intel.

the class Configuration method AddAbout.

void AddAbout() {
    Menu objMenu = new Menu("About");
    MenuItem item = new MenuItem("About");
    fAboutCreated = true;
    item.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            AboutBox.ShowAboutBox();
        }
    });
    objMenu.getItems().add(item);
    _MenuBar.getMenus().add(objMenu);
}
Also used : ActionEvent(javafx.event.ActionEvent) MenuItem(javafx.scene.control.MenuItem) Menu(javafx.scene.control.Menu)

Example 25 with MenuItem

use of javafx.scene.control.MenuItem in project swift by luastar.

the class MainController method initConsoleTextArea.

/**
 * 初始化控制台
 */
private void initConsoleTextArea() {
    // 不可编辑
    consoleTextArea.setEditable(false);
    // 右键清除按钮
    MenuItem clear = new MenuItem("清除");
    clear.setOnAction(event -> consoleTextArea.clear());
    ContextMenu contextMenu = new ContextMenu();
    contextMenu.getItems().add(clear);
    consoleTextArea.setContextMenu(contextMenu);
    // 设置日志属性
    Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    Appender<ILoggingEvent> appender = rootLogger.getAppender("gui");
    if (appender != null && (appender instanceof GuiLoggerAppender)) {
        ((GuiLoggerAppender) appender).setConsoleTextArea(consoleTextArea);
    }
}
Also used : GuiLoggerAppender(com.luastar.swift.tools.view.GuiLoggerAppender) MenuItem(javafx.scene.control.MenuItem) ContextMenu(javafx.scene.control.ContextMenu) Logger(ch.qos.logback.classic.Logger) ILoggingEvent(ch.qos.logback.classic.spi.ILoggingEvent)

Aggregations

MenuItem (javafx.scene.control.MenuItem)133 ContextMenu (javafx.scene.control.ContextMenu)72 Menu (javafx.scene.control.Menu)41 SeparatorMenuItem (javafx.scene.control.SeparatorMenuItem)41 ActionEvent (javafx.event.ActionEvent)30 File (java.io.File)23 VBox (javafx.scene.layout.VBox)21 List (java.util.List)20 Scene (javafx.scene.Scene)20 ArrayList (java.util.ArrayList)19 Label (javafx.scene.control.Label)19 Collectors (java.util.stream.Collectors)16 MenuBar (javafx.scene.control.MenuBar)15 ObservableList (javafx.collections.ObservableList)13 IOException (java.io.IOException)12 EventHandler (javafx.event.EventHandler)12 Button (javafx.scene.control.Button)12 FXCollections (javafx.collections.FXCollections)11 ImageView (javafx.scene.image.ImageView)11 KeyCodeCombination (javafx.scene.input.KeyCodeCombination)11