protected KeyStroke getKeyStroke ( KeyType key , int mods ) { boolean bShift = false , bCtrl = false , bAlt = false ; if ( key == null ) { return null ; } // alternative: key = KeyType.Unknown; if ( mods >= 0 ) { // only use when non-negative! bShift = ( mods & SHIFT ) != 0 ; bAlt = ( mods & ALT ) != 0 ; bCtrl = ( mods & CTRL ) != 0 ; } return new KeyStroke ( key , bCtrl , bAlt , bShift ) ; }
combines a KeyType and modifiers into a KeyStroke . Subclasses can override this for customization purposes .