1 /*
2 * Copyright (c) 1997, 2014, 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
858
859 void printMenuElementArray(MenuElement path[], boolean dumpStack) {
860 System.out.println("Path is(");
861 int i, j;
862 for(i=0,j=path.length; i<j ;i++){
863 for (int k=0; k<=i; k++)
864 System.out.print(" ");
865 MenuElement me = path[i];
866 if(me instanceof JMenuItem)
867 System.out.println(((JMenuItem)me).getText() + ", ");
868 else if (me == null)
869 System.out.println("NULL , ");
870 else
871 System.out.println("" + me + ", ");
872 }
873 System.out.println(")");
874
875 if (dumpStack == true)
876 Thread.dumpStack();
877 }
878 protected class MouseInputHandler implements MouseInputListener {
879 // NOTE: This class exists only for backward compatibility. All
880 // its functionality has been moved into Handler. If you need to add
881 // new functionality add it to the Handler, but make sure this
882 // class calls into the Handler.
883
884 public void mouseClicked(MouseEvent e) {
885 getHandler().mouseClicked(e);
886 }
887 public void mousePressed(MouseEvent e) {
888 getHandler().mousePressed(e);
889 }
890 public void mouseReleased(MouseEvent e) {
891 getHandler().mouseReleased(e);
892 }
893 public void mouseEntered(MouseEvent e) {
894 getHandler().mouseEntered(e);
895 }
896 public void mouseExited(MouseEvent e) {
897 getHandler().mouseExited(e);
898 }
899 public void mouseDragged(MouseEvent e) {
900 getHandler().mouseDragged(e);
901 }
902 public void mouseMoved(MouseEvent e) {
903 getHandler().mouseMoved(e);
904 }
905 }
906
907
908 private static class Actions extends UIAction {
909 private static final String CLICK = "doClick";
910
911 Actions(String key) {
912 super(key);
913 }
914
915 public void actionPerformed(ActionEvent e) {
916 JMenuItem mi = (JMenuItem)e.getSource();
917 MenuSelectionManager.defaultManager().clearSelectedPath();
918 mi.doClick();
919 }
920 }
921
|
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
858
859 void printMenuElementArray(MenuElement path[], boolean dumpStack) {
860 System.out.println("Path is(");
861 int i, j;
862 for(i=0,j=path.length; i<j ;i++){
863 for (int k=0; k<=i; k++)
864 System.out.print(" ");
865 MenuElement me = path[i];
866 if(me instanceof JMenuItem)
867 System.out.println(((JMenuItem)me).getText() + ", ");
868 else if (me == null)
869 System.out.println("NULL , ");
870 else
871 System.out.println("" + me + ", ");
872 }
873 System.out.println(")");
874
875 if (dumpStack == true)
876 Thread.dumpStack();
877 }
878 /** Mouse input handler */
879 protected class MouseInputHandler implements MouseInputListener {
880 // NOTE: This class exists only for backward compatibility. All
881 // its functionality has been moved into Handler. If you need to add
882 // new functionality add it to the Handler, but make sure this
883 // class calls into the Handler.
884
885 /** {@inheritDoc} */
886 public void mouseClicked(MouseEvent e) {
887 getHandler().mouseClicked(e);
888 }
889 /** {@inheritDoc} */
890 public void mousePressed(MouseEvent e) {
891 getHandler().mousePressed(e);
892 }
893 /** {@inheritDoc} */
894 public void mouseReleased(MouseEvent e) {
895 getHandler().mouseReleased(e);
896 }
897 /** {@inheritDoc} */
898 public void mouseEntered(MouseEvent e) {
899 getHandler().mouseEntered(e);
900 }
901 /** {@inheritDoc} */
902 public void mouseExited(MouseEvent e) {
903 getHandler().mouseExited(e);
904 }
905 /** {@inheritDoc} */
906 public void mouseDragged(MouseEvent e) {
907 getHandler().mouseDragged(e);
908 }
909 /** {@inheritDoc} */
910 public void mouseMoved(MouseEvent e) {
911 getHandler().mouseMoved(e);
912 }
913 }
914
915
916 private static class Actions extends UIAction {
917 private static final String CLICK = "doClick";
918
919 Actions(String key) {
920 super(key);
921 }
922
923 public void actionPerformed(ActionEvent e) {
924 JMenuItem mi = (JMenuItem)e.getSource();
925 MenuSelectionManager.defaultManager().clearSelectedPath();
926 mi.doClick();
927 }
928 }
929
|