96 |
return (KeyStroke) getAWTKeyStroke(keyCode, modifiers); |
return (KeyStroke) getAWTKeyStroke(keyCode, modifiers); |
97 |
} |
} |
98 |
|
|
99 |
|
/** |
100 |
|
* Returns the KeyStroke according to <code>getAWTKeyStroke()</code>. |
101 |
|
* But it returns null instead of throwing |
102 |
|
* <code>IllegalArugmentException</code> when |
103 |
|
* the keystoke sequence cannot be parsed from the given string. |
104 |
|
*/ |
105 |
public static KeyStroke getKeyStroke(String str) |
public static KeyStroke getKeyStroke(String str) |
106 |
{ |
{ |
107 |
return (KeyStroke) getAWTKeyStroke(str); |
try |
108 |
|
{ |
109 |
|
return (KeyStroke) getAWTKeyStroke(str); |
110 |
|
} |
111 |
|
catch (IllegalArgumentException iae) |
112 |
|
{ |
113 |
|
return null; |
114 |
|
} |
115 |
} |
} |
116 |
|
|
117 |
public static KeyStroke getKeyStrokeForEvent(KeyEvent event) |
public static KeyStroke getKeyStrokeForEvent(KeyEvent event) |