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 930 /** 931 * Call this method when a menu item is to be activated. 932 * This method handles some of the details of menu item activation 933 * such as clearing the selected path and messaging the 934 * JMenuItem's doClick() method. 935 * 936 * @param msm A MenuSelectionManager. The visual feedback and 937 * internal bookkeeping tasks are delegated to 938 * this MenuSelectionManager. If <code>null</code> is 939 * passed as this argument, the 940 * <code>MenuSelectionManager.defaultManager</code> is 941 * used. 942 * @see MenuSelectionManager 943 * @see JMenuItem#doClick(int) 944 * @since 1.4 945 */ 946 protected void doClick(MenuSelectionManager msm) { 947 // Auditory cue 948 if (! isInternalFrameSystemMenu()) { 949 BasicLookAndFeel.playSound(menuItem, getPropertyPrefix() + 950 ".commandSound"); 951 } 952 // Visual feedback 953 if (msm == null) { 954 msm = MenuSelectionManager.defaultManager(); 955 } 956 msm.clearSelectedPath(); 957 menuItem.doClick(0); 958 } 959 960 /** | 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 930 /** 931 * Call this method when a menu item is to be activated. 932 * This method handles some of the details of menu item activation 933 * such as clearing the selected path and messaging the 934 * JMenuItem's doClick() method. 935 * 936 * @param msm A MenuSelectionManager. The visual feedback and 937 * internal bookkeeping tasks are delegated to 938 * this MenuSelectionManager. If {@code null} is 939 * passed as this argument, the 940 * {@code MenuSelectionManager.defaultManager} is 941 * used. 942 * @see MenuSelectionManager 943 * @see JMenuItem#doClick(int) 944 * @since 1.4 945 */ 946 protected void doClick(MenuSelectionManager msm) { 947 // Auditory cue 948 if (! isInternalFrameSystemMenu()) { 949 BasicLookAndFeel.playSound(menuItem, getPropertyPrefix() + 950 ".commandSound"); 951 } 952 // Visual feedback 953 if (msm == null) { 954 msm = MenuSelectionManager.defaultManager(); 955 } 956 msm.clearSelectedPath(); 957 menuItem.doClick(0); 958 } 959 960 /** |