163 if (obj instanceof MenuShortcut) {
164 return equals( (MenuShortcut) obj );
165 }
166 return false;
167 }
168
169 /**
170 * Returns the hashcode for this MenuShortcut.
171 * @return the hashcode for this MenuShortcut.
172 * @since 1.2
173 */
174 public int hashCode() {
175 return (usesShift) ? (~key) : key;
176 }
177
178 /**
179 * Returns an internationalized description of the MenuShortcut.
180 * @return a string representation of this MenuShortcut.
181 * @since 1.1
182 */
183 public String toString() {
184 int modifiers = 0;
185 if (!GraphicsEnvironment.isHeadless()) {
186 modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
187 }
188 if (usesShiftModifier()) {
189 modifiers |= Event.SHIFT_MASK;
190 }
191 return KeyEvent.getKeyModifiersText(modifiers) + "+" +
192 KeyEvent.getKeyText(key);
193 }
194
195 /**
196 * Returns the parameter string representing the state of this
197 * MenuShortcut. This string is useful for debugging.
198 * @return the parameter string of this MenuShortcut.
199 * @since 1.1
200 */
201 protected String paramString() {
202 String str = "key=" + key;
|
163 if (obj instanceof MenuShortcut) {
164 return equals( (MenuShortcut) obj );
165 }
166 return false;
167 }
168
169 /**
170 * Returns the hashcode for this MenuShortcut.
171 * @return the hashcode for this MenuShortcut.
172 * @since 1.2
173 */
174 public int hashCode() {
175 return (usesShift) ? (~key) : key;
176 }
177
178 /**
179 * Returns an internationalized description of the MenuShortcut.
180 * @return a string representation of this MenuShortcut.
181 * @since 1.1
182 */
183 @SuppressWarnings("deprecation")
184 public String toString() {
185 int modifiers = 0;
186 if (!GraphicsEnvironment.isHeadless()) {
187 modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
188 }
189 if (usesShiftModifier()) {
190 modifiers |= Event.SHIFT_MASK;
191 }
192 return KeyEvent.getKeyModifiersText(modifiers) + "+" +
193 KeyEvent.getKeyText(key);
194 }
195
196 /**
197 * Returns the parameter string representing the state of this
198 * MenuShortcut. This string is useful for debugging.
199 * @return the parameter string of this MenuShortcut.
200 * @since 1.1
201 */
202 protected String paramString() {
203 String str = "key=" + key;
|