Issue
My application used Java 8 and on MacOS many actions have shortcuts defined that work fine, such as this one defined to use COMMAND-1
public final class AutoCorrectAction
extends CorrecterAction
{
private static final String ACTION_NAME = "autocorrect";
public AutoCorrectAction(final int paneIndex)
{
super(ACTION_NAME, TextLabel.MENU_AUTOCORRECT.getMsg(), paneIndex);
if (paneIndex == TagDisplayer.INDEX_NONE)
{
putValue(ACCELERATOR_KEY,(KeyStroke.getKeyStroke(KeyEvent.VK_1,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())));
}
this.putValue(Action.SMALL_ICON, JaikozIcon.LOCAL_AUTOCORRECT.getIconSmall());
this.putValue(JaikozAction.LARGE_ICON, JaikozIcon.LOCAL_AUTOCORRECT.getIconLarge());
this.putValue(Action.SHORT_DESCRIPTION,TextLabel.MENU_AUTOCORRECTTOOLTIP.getMsg());
}
public final void actionPerformed(final ActionEvent e)
{
start.logger.entering(this.getClass().getName(), JaikozLogFormatter.ACTION_PERFORMED);
this.performTask(new AutoCorrecter(start, isSelectedOnly(e), isUseRowSelection));
start.logger.exiting(this.getClass().getName(), JaikozLogFormatter.ACTION_PERFORMED);
}
}
My latest version of software now uses Java 11, and now when i press COMMAND-1 it minimizes the windows and shows in Finder, a google search determined this is a standard mac shortcut - https://support.apple.com/en-us/HT201236
Command-1: View the items in the Finder window as icons.
So my question is what is the correct mac behaviour, should my shortcut in my application override the MacOS shortcut or not, i.e is this a bug introduced in Java 11 or was the previous behaviour buggy and now fixed.
Confusingly, I have another action defined in the same way that uses Command-2, this is also a standard MacOS shortcut
Command-2: View the items in a Finder window as a list.
public final class CreateAcousticIdAction
extends CorrecterAction
{
private static final String ACTION_NAME = "createmusicipacousticid";
public CreateAcousticIdAction(final int paneIndex)
{
super(CreateAcousticIdAction.ACTION_NAME, TextLabel.MENU_CREATE_MUSICIP_ACOUSTIC_ID.getMsg(), paneIndex);
this.putValue(Action.SMALL_ICON, JaikozIcon.CREATE_MUSICIP_PUID.getIconSmall());
this.putValue(JaikozAction.LARGE_ICON, JaikozIcon.CREATE_MUSICIP_PUID.getIconLarge());
this.putValue(Action.SHORT_DESCRIPTION, TextLabel.MENU_CREATE_MUSICIP_ACOUSTIC_IDTOOLTIP.getMsg());
putValue(ACCELERATOR_KEY,(KeyStroke.getKeyStroke(KeyEvent.VK_2,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())));
}
public final void actionPerformed(final ActionEvent e)
{
this.performTask(new CreateAcoustId(start, isSelectedOnly(e), isUseRowSelection), JaikozThreadGroup.THREAD_CREATE_ACOUSTICID);
}
}
yet my shortcut continues to work and is not overridden by MacOS shortcuts !
Update I have created movie as requested - http://www.jthink.net/jaikoz/scratch/cmd1issue.mov
What I now notice is that when I press Cmd-1 it minimizes the window, but its run autocorrect as well so it does both things.
Solution
Found the issue, I didnt realize that I was also using Command-1 for maxmizing windows within the application as well, removing this shortcut resolved the issue
Answered By - Paul Taylor
Answer Checked By - Clifford M. (JavaFixing Volunteer)