Java 类javafx.scene.input.KeyCharacterCombination 实例源码

项目:ScreenFX    文件:ScreenFXKeyChecker.java   
static String getStringRepresentation(String keyCodePropertyName) {

        if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCodeCombination) {
            return ((KeyCodeCombination) ScreenFXConfig.getInstance().get(keyCodePropertyName)).getName();
        }

        if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCombination) {
            return ((KeyCombination) ScreenFXConfig.getInstance().get(keyCodePropertyName)).getName();
        }
        if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCharacterCombination) {
            return ((KeyCharacterCombination) ScreenFXConfig.getInstance().get(keyCodePropertyName))
                    .getName();
        }
        if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCode) {
            return ((KeyCode) ScreenFXConfig.getInstance().get(keyCodePropertyName)).getName();
        }

        return null;

    }
项目:Gargoyle    文件:MacroSqlComposite.java   
@FxPostInitialize
public void post() {

    // 스크립트 실행
    ExecutorDemons.getGargoyleSystemExecutorSerivce().execute(() -> {
        if (createScript != null) {
            try {
                createScript.execute();
            } catch (Exception e1) {
                LOGGER.error(ValueUtil.toString(e1));
            }
        }
    });

    MenuItem menuAddItem = new MenuItem("Add");
    menuAddItem.setAccelerator(new KeyCodeCombination(KeyCode.INSERT, KeyCharacterCombination.CONTROL_DOWN));
    menuAddItem.setOnAction(e -> {
        addOnAction();
    });

    MenuItem menuDeleteItem = new MenuItem("Delete");
    menuDeleteItem.setAccelerator(new KeyCodeCombination(KeyCode.DELETE, KeyCharacterCombination.CONTROL_DOWN));
    menuDeleteItem.setOnAction(e -> {
        addOnAction();
    });

    tvFavorite.setContextMenu(new ContextMenu(menuAddItem, menuDeleteItem));

    borContent.setCenter(new MacroControl(connectionSupplier, initText));

    MacroFavorTreeItemCreator macroFavorTreeItem = new MacroFavorTreeItemCreator(connectionSupplier);

    MacroItemVO f = new MacroItemVO();
    tvFavorite.setRoot(macroFavorTreeItem.createRoot(f));
    tvFavorite.setShowRoot(true);
}
项目:Vector-Pinball-Editor    文件:Main.java   
MenuItem createMenuItem(String label, String shortcutChar, Runnable onAction) {
    MenuItem item = new MenuItem(label);
    if (shortcutChar != null) {
        item.setAccelerator(new KeyCharacterCombination(shortcutChar, KeyCombination.SHORTCUT_DOWN));
    }
    if (onAction != null) {
        item.setOnAction((event) -> onAction.run());
    }
    return item;
}
项目:ScreenFX    文件:ScreenFXKeyChecker.java   
/**
 * @param keyCodePropertyName
 *            the keycode name from properties
 * @param event
 *            the key event to check
 * @return true or false
 */
public static boolean checkKeyEvent(String keyCodePropertyName, KeyEvent event) {
    if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCodeCombination) {
        if (((KeyCodeCombination) ScreenFXConfig.getInstance().get(keyCodePropertyName)).match(event)) {
            return true;
        }
    }
    if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCombination) {
        if (((KeyCombination) ScreenFXConfig.getInstance().get(keyCodePropertyName)).match(event)) {
            return true;
        }
    }

    if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCharacterCombination) {
        if (((KeyCharacterCombination) ScreenFXConfig.getInstance().get(keyCodePropertyName))
                .match(event)) {
            return true;
        }
    }

    if (ScreenFXConfig.getInstance().get(keyCodePropertyName) instanceof KeyCode) {
        if (((KeyCode) ScreenFXConfig.getInstance().get(keyCodePropertyName)) == event.getCode()) {
            return true;
        }
    }
    return false;

}
项目:Vector-Pinball-Editor    文件:Main.java   
MenuBar buildMenuBar() {
    Menu fileMenu = new Menu("File");

    Menu newFromTemplateMenu = new Menu("New From Template");
    newFromTemplateMenu.getItems().addAll(
            createMenuItem("Table 1", null, () -> loadBuiltInField(1)),
            createMenuItem("Table 2", null, () -> loadBuiltInField(2)),
            createMenuItem("Table 3", null, () -> loadBuiltInField(3)),
            createMenuItem("Table 4", null, () -> loadBuiltInField(4)),
            createMenuItem("Table 5", null, () -> loadBuiltInField(5))
            );

    fileMenu.getItems().addAll(
            createMenuItem("New Table", "N", () -> loadStarterField()),
            newFromTemplateMenu,
            new SeparatorMenuItem(),
            createMenuItem("Open", "O", this::openFile),
            createMenuItem("Save", "S", this::saveFile)
            );

    Menu editMenu = new Menu("Edit");
    MenuItem undoItem = createMenuItem("Undo", "Z", this::undoEdit);
    MenuItem redoItem = createMenuItem("Redo", null, this::redoEdit);
    redoItem.setAccelerator(new KeyCharacterCombination(
            "Z", KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    editMenu.getItems().addAll(undoItem, redoItem);

    Menu viewMenu = new Menu("View");
    viewMenu.getItems().addAll(
            createMenuItem("Zoom In", "+", this::zoomIn),
            createMenuItem("Zoom Out", "-", this::zoomOut),
            createMenuItem("Default Zoom", "0", this::zoomDefault));

    Menu helpMenu = new Menu("Help");
    helpMenu.getItems().addAll(
            createMenuItem("About...", null, this::showAboutDialog));

    MenuBar mbar = new MenuBar();
    mbar.getMenus().addAll(fileMenu, editMenu, viewMenu, helpMenu);
    return mbar;
}
项目:WellBehavedFX    文件:EventPattern.java   
static EventPattern<Event, KeyEvent> keyPressed(String character, KeyCombination.Modifier... modifiers) {
    return keyPressed(new KeyCharacterCombination(character, modifiers));
}
项目:WellBehavedFX    文件:EventPattern.java   
static EventPattern<Event, KeyEvent> keyReleased(String character, KeyCombination.Modifier... modifiers) {
    return keyReleased(new KeyCharacterCombination(character, modifiers));
}