Java Code Examples for javafx.scene.input.KeyCombination#NO_MATCH

The following examples show how to use javafx.scene.input.KeyCombination#NO_MATCH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Preferences_Controller.java    From Path-of-Leveling with MIT License 6 votes vote down vote up
private KeyCombination loadKeybinds(Properties prop, String propertyName, TextField kc_field){
    String loadProp = prop.getProperty(propertyName);
    KeyCombination keyCombination = null;
    //this should load the keybind on the controller but not overwrite
    if(loadProp == null){
        //loadProp = hotkeyDefaults.get(propertyName); <- load default or
        return KeyCombination.NO_MATCH;
    }
    try{
        keyCombination = KeyCombination.keyCombination(loadProp);
        System.out.println("-Preferences- Loaded keybind : " + keyCombination.getName() + " for "+ propertyName);
    }catch(Exception e){
        System.out.println("-Preferences- Loading keybind for "+ propertyName+" failed.");
        keyCombination = KeyCombination.NO_MATCH;
    }
    kc_field.setText(loadProp);
    return keyCombination;
}
 
Example 2
Source File: POELevelFx.java    From Path-of-Leveling with MIT License 6 votes vote down vote up
private KeyCombination loadKeybinds(Properties prop, String propertyName, String defaultValue){
    //check if hotkey is null, on older versions
    String loadProp = prop.getProperty(propertyName);
    KeyCombination keyCombination = null;
    //this should load the keybind on the controller but not overwrite
    if(loadProp == null){
        //loadProp = defaultValue; <- load default or
        return KeyCombination.NO_MATCH;
    }
    try{
        keyCombination = KeyCombination.keyCombination(loadProp);
        System.out.println("-POELevelFx- Loading keybind " + keyCombination.getName() +" for " + propertyName);
    }catch(Exception e){
        System.out.println("-POELevelFx- Loading keybind for " + propertyName+ " failed.");
        keyCombination = KeyCombination.NO_MATCH;
    }
    return keyCombination;
}
 
Example 3
Source File: Preferences_Controller.java    From Path-of-Leveling with MIT License 5 votes vote down vote up
private KeyCombination saveKeybinds(Properties prop, String propertyName, String kc_field_text){
    prop.setProperty(propertyName, kc_field_text);
    KeyCombination keyCombination = null;
    try{
        keyCombination = KeyCombination.keyCombination(kc_field_text);
        System.out.println("-Preferences- Saved keybind : " + keyCombination.getName()+ " for "+propertyName);
    }catch(Exception e){
        System.out.println("-Preferences- Saving keybind : for "+propertyName + " failed.");
        keyCombination = KeyCombination.NO_MATCH;
    }
    return keyCombination;
}
 
Example 4
Source File: POELevelFx.java    From Path-of-Leveling with MIT License 5 votes vote down vote up
private KeyCombination setKeybinds(Properties prop, String propertyName, String defaultValue){
    prop.setProperty(propertyName, defaultValue);
    KeyCombination keyCombination = null;
    try{
        keyCombination = KeyCombination.keyCombination(defaultValue);
        System.out.println("-POELevelFx- Setting keybind for : " + keyCombination.getName() +" for " + propertyName);
    }catch(Exception e){
        System.out.println("-POELevelFx- Setting keybind for :" + propertyName + " failed.");
        keyCombination = KeyCombination.NO_MATCH;
    }
    return keyCombination;
}
 
Example 5
Source File: Preferences_Controller.java    From Path-of-Leveling with MIT License 4 votes vote down vote up
private KeyCombination handleKeybindEdit(KeyEvent event, TextField kc_field, int nodeID){
    if(event.isAltDown()){
        key_bind = "Alt+";
        if(event.getCode().getName().equals("Alt")){
            key_bind = "Alt";
        }else{
            key_bind += event.getCode().getName();
        }
    }else if(event.isControlDown()){
        key_bind = "Ctrl+";
        if(event.getCode().getName().equals("Ctrl")){
            key_bind = "Ctrl";
        }else{
            key_bind += event.getCode().getName();
        }

    }else if(event.isShiftDown()){
        key_bind = "Shift+";
        if(event.getCode().getName().equals("Shift")){
            key_bind = "Shift";
        }else{
            key_bind += event.getCode().getName();
        }

    }else{
        key_bind += event.getCode().getName();
    }
    KeyCombination kc_temp;
    try{
        kc_temp = KeyCombination.keyCombination(key_bind);
        isBeingUsed(kc_temp,nodeID);
        kc_field.setText(key_bind);
        //System.out.println("key code : " + kc_temp.getName());
        //zones_hotkey_show_hide_key = keyCombination;
    }catch(IllegalArgumentException e){
        kc_field.setText("");
        //System.out.println(":incorect:");
        kc_temp = KeyCombination.NO_MATCH;
    }finally{
        key_bind = "";
    }
    return kc_temp;
}