Search in sources :

Example 16 with MenuItem

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

the class DesignerFx method createFxMenuBar.

//	private JMenuBar createMenuBar() {
//		JMenuBar menuBar = new JMenuBar();
//		JMenu menu = new JMenu("Language");
//		ButtonGroup group = new ButtonGroup();
//
//		LanguageVersion[] languageVersions = getSupportedLanguageVersions();
//		for (int i = 0; i < languageVersions.length; i++) {
//			LanguageVersion languageVersion = languageVersions[i];
//			MenuItem button = new MenuItem(languageVersion.getShortName());
//			languageVersionMenuItems[i] = button;
//			group.add(button);
//			menu.add(button);
//		}
//		languageVersionMenuItems[DEFAULT_LANGUAGE_VERSION_SELECTION_INDEX].setSelected(true);
//		menuBar.add(menu);
//
//		JMenu actionsMenu = new JMenu("Actions");
//		JMenuItem copyXMLItem = new JMenuItem("Copy xml to clipboard");
//		copyXMLItem.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				copyXmlToClipboard();
//			}
//		});
//		actionsMenu.add(copyXMLItem);
//		JMenuItem createRuleXMLItem = new JMenuItem("Create rule XML");
//		createRuleXMLItem.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				createRuleXML();
//			}
//		});
//		actionsMenu.add(createRuleXMLItem);
//		menuBar.add(actionsMenu);
//
//		return menuBar;
//	}
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;
}
Also used : ToggleGroup(javafx.scene.control.ToggleGroup) JMenuBar(javax.swing.JMenuBar) MenuBar(javafx.scene.control.MenuBar) LanguageVersion(net.sourceforge.pmd.lang.LanguageVersion) MenuItem(javafx.scene.control.MenuItem) RadioMenuItem(javafx.scene.control.RadioMenuItem) Menu(javafx.scene.control.Menu) RadioMenuItem(javafx.scene.control.RadioMenuItem)

Example 17 with MenuItem

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

the class SqlPane method createTreeContextMenu.

/**
	 * 컨텍스트 메뉴 생성 및 기능 적용
	 *
	 *
	 * 2016-10-27 키 이벤트를 setAccelerator를 사용하지않고 이벤트 방식으로 변경 이유 : 도킹기능을 적용하하면
	 * setAccelerator에 등록된 이벤트가 호출안됨
	 *
	 * @param schemaTree2
	 */
private void createTreeContextMenu(TreeView<K> schemaTree) {
    MenuItem menuSelectScript = new MenuItem("Select Script");
    menuSelectScript.setOnAction(this::applySelectScript);
    MenuItem menuUpdateScript = new MenuItem("Update Script");
    menuUpdateScript.setOnAction(this::applyUpdateScript);
    MenuItem menuDeleteScript = new MenuItem("Delete Script");
    menuDeleteScript.setOnAction(this::applyDeleteSelectScript);
    MenuItem menuInsertScript = new MenuItem("Insert Script");
    menuInsertScript.setOnAction(this::applyInsertScript);
    Menu menu = new Menu("Script", null, menuSelectScript, menuUpdateScript, menuDeleteScript, menuInsertScript);
    // MenuItem menuPrimaryKeys = new MenuItem("Primary Keys");
    MenuItem menuShowData = new MenuItem("Show 100 rows [F1]");
    menuShowData.setOnAction(this::show100RowAction);
    MenuItem menuEditShowData = new MenuItem("Show Editable View  [CTRL + F1]");
    menuEditShowData.setOnAction(this::menuEditShowDataAction);
    MenuItem menuFindTable = new MenuItem("Find Table [CTRL + SHIFT + R]");
    // menuFindTable.setAccelerator(new KeyCodeCombination(KeyCode.R,
    // KeyCombination.CONTROL_DOWN));
    menuFindTable.setOnAction(this::showFileTableOnAction);
    MenuItem menuProperties = new MenuItem("Properties");
    menuProperties.setOnAction(this::showProperties);
    MenuItem menuReflesh = new MenuItem("Reflesh [F5]");
    // menuReflesh.setOnAction(this::menuRefleshOnAction);
    menuReflesh.setAccelerator(new KeyCodeCombination(KeyCode.F5));
    ContextMenu contextMenu = new ContextMenu(menu, menuShowData, menuEditShowData, menuFindTable, menuProperties, new SeparatorMenuItem(), menuReflesh);
    schemaTree.setContextMenu(contextMenu);
}
Also used : MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) ContextMenu(javafx.scene.control.ContextMenu) Menu(javafx.scene.control.Menu) ContextMenu(javafx.scene.control.ContextMenu) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 18 with MenuItem

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

the class CommonsContextMenu method addMenus.

/**
	 * 컨텍스트 메뉴 추가.
	 * 
	 * @param node
	 * @param items
	 */
public static void addMenus(Control node, MenuItem... items) {
    ContextMenu contextMenu = new ContextMenu();
    if (items != null) {
        for (MenuItem item : items) {
            contextMenu.getItems().add(item);
        }
    }
    node.setContextMenu(contextMenu);
}
Also used : ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem)

Example 19 with MenuItem

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

the class CodeAreaFindAndReplaceHelper method createMenus.

/**
	 *  FindAndReplace에 대한 메뉴를 정의.
	 * @return
	 * @작성자 : KYJ
	 * @작성일 : 2017. 1. 13.
	 */
public Menu createMenus() {
    menuSearch = new Menu("Search");
    miFindReplace = new MenuItem("Find/Replace");
    miFindReplace.setAccelerator(new KeyCodeCombination(KeyCode.F, KeyCombination.CONTROL_DOWN));
    miFindReplace.setOnAction(this::findReplaceEvent);
    menuSearch.getItems().add(miFindReplace);
    return menuSearch;
}
Also used : MenuItem(javafx.scene.control.MenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Menu(javafx.scene.control.Menu)

Example 20 with MenuItem

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

the class CodeAreaHelper method createMenus.

/**
	 *
	 * 2016-10-27 키 이벤트를 setAccelerator를 사용하지않고 이벤트 방식으로 변경 이유 : 도킹기능을 적용하하면
	 * setAccelerator에 등록된 이벤트가 호출안됨
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 10. 27.
	 */
public void createMenus() {
    Menu menuSearch = findAndReplaceHelper.createMenus();
    menuMoveToLine = new MenuItem("Move to line");
    miToUppercase = new MenuItem("To Uppercase");
    miToLowercase = new MenuItem("To Lowercase");
    menuMoveToLine.setAccelerator(new KeyCodeCombination(KeyCode.L, KeyCombination.CONTROL_DOWN));
    menuMoveToLine.setOnAction(this::moveToLineEvent);
    miToUppercase.setAccelerator(new KeyCodeCombination(KeyCode.U, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN));
    miToUppercase.setOnAction(this::toUppercaseEvent);
    miToLowercase.setAccelerator(new KeyCodeCombination(KeyCode.L, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN));
    miToLowercase.setOnAction(this::toLowercaseEvent);
    codeArea.getContextMenu().getItems().addAll(menuSearch, menuMoveToLine, miToUppercase, miToLowercase);
}
Also used : MenuItem(javafx.scene.control.MenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Menu(javafx.scene.control.Menu) ContextMenu(javafx.scene.control.ContextMenu)

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