1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
396 }
397 else {
398 super.actionPropertyChanged(action, propertyName);
399 }
400 }
401
402 /**
403 * Processes a mouse event forwarded from the
404 * <code>MenuSelectionManager</code> and changes the menu
405 * selection, if necessary, by using the
406 * <code>MenuSelectionManager</code>'s API.
407 * <p>
408 * Note: you do not have to forward the event to sub-components.
409 * This is done automatically by the <code>MenuSelectionManager</code>.
410 *
411 * @param e a <code>MouseEvent</code>
412 * @param path the <code>MenuElement</code> path array
413 * @param manager the <code>MenuSelectionManager</code>
414 */
415 @SuppressWarnings("deprecation")
416 public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
417 processMenuDragMouseEvent(
418 new MenuDragMouseEvent(e.getComponent(), e.getID(),
419 e.getWhen(),
420 e.getModifiers(), e.getX(), e.getY(),
421 e.getXOnScreen(), e.getYOnScreen(),
422 e.getClickCount(), e.isPopupTrigger(),
423 path, manager));
424 }
425
426
427 /**
428 * Processes a key event forwarded from the
429 * <code>MenuSelectionManager</code> and changes the menu selection,
430 * if necessary, by using <code>MenuSelectionManager</code>'s API.
431 * <p>
432 * Note: you do not have to forward the event to sub-components.
433 * This is done automatically by the <code>MenuSelectionManager</code>.
434 *
435 * @param e a <code>KeyEvent</code>
436 * @param path the <code>MenuElement</code> path array
437 * @param manager the <code>MenuSelectionManager</code>
438 */
439 @SuppressWarnings("deprecation")
440 public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
441 if (DEBUG) {
442 System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +
443 " " + KeyStroke.getKeyStrokeForEvent(e));
444 }
445 MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(),
446 e.getWhen(), e.getModifiers(),
447 e.getKeyCode(), e.getKeyChar(),
448 path, manager);
449 processMenuKeyEvent(mke);
450
451 if (mke.isConsumed()) {
452 e.consume();
453 }
454 }
455
456
457
458 /**
459 * Handles mouse drag in a menu.
460 *
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
396 }
397 else {
398 super.actionPropertyChanged(action, propertyName);
399 }
400 }
401
402 /**
403 * Processes a mouse event forwarded from the
404 * <code>MenuSelectionManager</code> and changes the menu
405 * selection, if necessary, by using the
406 * <code>MenuSelectionManager</code>'s API.
407 * <p>
408 * Note: you do not have to forward the event to sub-components.
409 * This is done automatically by the <code>MenuSelectionManager</code>.
410 *
411 * @param e a <code>MouseEvent</code>
412 * @param path the <code>MenuElement</code> path array
413 * @param manager the <code>MenuSelectionManager</code>
414 */
415 @SuppressWarnings("deprecation")
416 public void processMouseEvent(MouseEvent e,MenuElement[] path,MenuSelectionManager manager) {
417 processMenuDragMouseEvent(
418 new MenuDragMouseEvent(e.getComponent(), e.getID(),
419 e.getWhen(),
420 e.getModifiers(), e.getX(), e.getY(),
421 e.getXOnScreen(), e.getYOnScreen(),
422 e.getClickCount(), e.isPopupTrigger(),
423 path, manager));
424 }
425
426
427 /**
428 * Processes a key event forwarded from the
429 * <code>MenuSelectionManager</code> and changes the menu selection,
430 * if necessary, by using <code>MenuSelectionManager</code>'s API.
431 * <p>
432 * Note: you do not have to forward the event to sub-components.
433 * This is done automatically by the <code>MenuSelectionManager</code>.
434 *
435 * @param e a <code>KeyEvent</code>
436 * @param path the <code>MenuElement</code> path array
437 * @param manager the <code>MenuSelectionManager</code>
438 */
439 @SuppressWarnings("deprecation")
440 public void processKeyEvent(KeyEvent e,MenuElement[] path,MenuSelectionManager manager) {
441 if (DEBUG) {
442 System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +
443 " " + KeyStroke.getKeyStrokeForEvent(e));
444 }
445 MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(),
446 e.getWhen(), e.getModifiers(),
447 e.getKeyCode(), e.getKeyChar(),
448 path, manager);
449 processMenuKeyEvent(mke);
450
451 if (mke.isConsumed()) {
452 e.consume();
453 }
454 }
455
456
457
458 /**
459 * Handles mouse drag in a menu.
460 *
|