Example usage for javafx.scene.input KeyCode COMMA

List of usage examples for javafx.scene.input KeyCode COMMA

Introduction

In this page you can find the example usage for javafx.scene.input KeyCode COMMA.

Prototype

KeyCode COMMA

To view the source code for javafx.scene.input KeyCode COMMA.

Click Source Link

Document

Constant for the comma key, ","

Usage

From source file:se.trixon.filebydate.ui.MainApp.java

private void initAccelerators() {
    final ObservableMap<KeyCombination, Runnable> accelerators = mStage.getScene().getAccelerators();

    accelerators.put(new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN), (Runnable) () -> {
        mStage.fireEvent(new WindowEvent(mStage, WindowEvent.WINDOW_CLOSE_REQUEST));
    });/*ww  w  .ja  va2 s .  co  m*/

    accelerators.put(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN), (Runnable) () -> {
        profileEdit(null);
    });

    if (!IS_MAC) {
        accelerators.put(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.SHORTCUT_DOWN), (Runnable) () -> {
            displayOptions();
        });
    }
}

From source file:se.trixon.filebydate.ui.MainApp.java

private void initActions() {
    //add//ww  w. j  ava  2 s .  c  o m
    mAddAction = new Action(Dict.ADD.toString(), (ActionEvent event) -> {
        profileEdit(null);
    });
    mAddAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.PLUS).size(ICON_SIZE_TOOLBAR).color(mIconColor));

    //cancel
    mCancelAction = new Action(Dict.CANCEL.toString(), (ActionEvent event) -> {
        mOperationThread.interrupt();
    });
    mCancelAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.BAN).size(ICON_SIZE_TOOLBAR).color(mIconColor));

    //home
    mHomeAction = new Action(Dict.LIST.toString(), (ActionEvent event) -> {
        mLogAction.setDisabled(false);
        setRunningState(RunState.STARTABLE);
        mRoot.setCenter(mListView);
    });
    mHomeAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.LIST).size(ICON_SIZE_TOOLBAR).color(mIconColor));

    //log
    mLogAction = new Action(Dict.OUTPUT.toString(), (ActionEvent event) -> {
        setRunningState(RunState.CLOSEABLE);
        mRoot.setCenter(mProgressPanel);
    });
    mLogAction.setGraphic(
            mFontAwesome.create(FontAwesome.Glyph.ALIGN_LEFT).size(ICON_SIZE_TOOLBAR).color(mIconColor));
    mLogAction.setDisabled(true);

    //options
    mOptionsAction = new Action(Dict.OPTIONS.toString(), (ActionEvent event) -> {
        displayOptions();
    });
    mOptionsAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.COG).size(ICON_SIZE_TOOLBAR).color(mIconColor));
    if (!IS_MAC) {
        mOptionsAction.setAccelerator(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.SHORTCUT_DOWN));
    }

    //help
    mHelpAction = new Action(Dict.HELP.toString(), (ActionEvent event) -> {
        SystemHelper.desktopBrowse("https://trixon.se/projects/filebydate/documentation/");
    });
    mHelpAction.setAccelerator(KeyCombination.keyCombination("F1"));

    //about
    PomInfo pomInfo = new PomInfo(FileByDate.class, "se.trixon", "filebydate");
    AboutModel aboutModel = new AboutModel(SystemHelper.getBundle(FileByDate.class, "about"),
            SystemHelper.getResourceAsImageView(MainApp.class, "calendar-icon-1024px.png"));
    aboutModel.setAppVersion(pomInfo.getVersion());
    mAboutAction = AboutPane.getAction(mStage, aboutModel);

    //about date format
    String title = String.format(Dict.ABOUT_S.toString(), Dict.DATE_PATTERN.toString().toLowerCase());
    mAboutDateFormatAction = new Action(title, (ActionEvent event) -> {
        SystemHelper.desktopBrowse("https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html");
    });

    mRunAction = new Action(Dict.RUN.toString(), (ActionEvent event) -> {
        profileRun(mLastRunProfile);
    });
    mRunAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.PLAY).size(ICON_SIZE_TOOLBAR).color(mIconColor));
}

From source file:se.trixon.filebydate.ui.MainApp.java

private void initMac() {
    MenuToolkit menuToolkit = MenuToolkit.toolkit();
    Menu applicationMenu = menuToolkit.createDefaultApplicationMenu(APP_TITLE);
    menuToolkit.setApplicationMenu(applicationMenu);

    applicationMenu.getItems().remove(0);
    MenuItem aboutMenuItem = new MenuItem(String.format(Dict.ABOUT_S.toString(), APP_TITLE));
    aboutMenuItem.setOnAction(mAboutAction);

    MenuItem settingsMenuItem = new MenuItem(Dict.PREFERENCES.toString());
    settingsMenuItem.setOnAction(mOptionsAction);
    settingsMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.SHORTCUT_DOWN));

    applicationMenu.getItems().add(0, aboutMenuItem);
    applicationMenu.getItems().add(2, settingsMenuItem);

    int cnt = applicationMenu.getItems().size();
    applicationMenu.getItems().get(cnt - 1).setText(String.format("%s %s", Dict.QUIT.toString(), APP_TITLE));
}

From source file:se.trixon.mapollage.ui.MainApp.java

private void initActions() {
    //add//from w w  w . ja  v  a 2  s . c om
    mAddAction = new Action(Dict.ADD.toString(), (ActionEvent event) -> {
        profileEdit(null);
    });
    mAddAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.PLUS).size(ICON_SIZE_TOOLBAR).color(mIconColor));

    //cancel
    mCancelAction = new Action(Dict.CANCEL.toString(), (ActionEvent event) -> {
        mOperationThread.interrupt();
    });
    mCancelAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.BAN).size(ICON_SIZE_TOOLBAR).color(mIconColor));

    //home
    mHomeAction = new Action(Dict.LIST.toString(), (ActionEvent event) -> {
        mLogAction.setDisabled(false);
        setRunningState(RunState.STARTABLE);
        mRoot.setCenter(mListView);
    });
    mHomeAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.LIST).size(ICON_SIZE_TOOLBAR).color(mIconColor));

    //log
    mLogAction = new Action(Dict.OUTPUT.toString(), (ActionEvent event) -> {
        setRunningState(RunState.CLOSEABLE);
        mRoot.setCenter(mProgressPanel);
    });
    mLogAction.setGraphic(
            mFontAwesome.create(FontAwesome.Glyph.ALIGN_LEFT).size(ICON_SIZE_TOOLBAR).color(mIconColor));
    mLogAction.setDisabled(true);

    //options
    mOptionsAction = new Action(Dict.OPTIONS.toString(), (ActionEvent event) -> {
        displayOptions();
    });
    mOptionsAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.COG).size(ICON_SIZE_TOOLBAR).color(mIconColor));
    if (!IS_MAC) {
        mOptionsAction.setAccelerator(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.SHORTCUT_DOWN));
    }

    //help
    mHelpAction = new Action(Dict.HELP.toString(), (ActionEvent event) -> {
        SystemHelper.desktopBrowse("https://trixon.se/projects/mapollage/documentation/");
    });
    mHelpAction.setAccelerator(KeyCombination.keyCombination("F1"));

    //about
    PomInfo pomInfo = new PomInfo(Mapollage.class, "se.trixon", "mapollage");
    AboutModel aboutModel = new AboutModel(SystemHelper.getBundle(Mapollage.class, "about"),
            SystemHelper.getResourceAsImageView(MainApp.class, "icon-1024px.png"));
    aboutModel.setAppVersion(pomInfo.getVersion());
    mAboutAction = AboutPane.getAction(mStage, aboutModel);

    //about date format
    String title = String.format(Dict.ABOUT_S.toString(), Dict.DATE_PATTERN.toString().toLowerCase());
    mAboutDateFormatAction = new Action(title, (ActionEvent event) -> {
        SystemHelper.desktopBrowse("https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html");
    });

    mRunAction = new Action(Dict.RUN.toString(), (ActionEvent event) -> {
        profileRun(mLastRunProfile);
    });
    mRunAction
            .setGraphic(mFontAwesome.create(FontAwesome.Glyph.PLAY).size(ICON_SIZE_TOOLBAR).color(mIconColor));
}