From e0e788e4c477b2aac343f2b3a4edcf18616e7304 Mon Sep 17 00:00:00 2001 From: matthiasgeiger Date: Wed, 2 Nov 2016 20:51:11 +0100 Subject: [PATCH] enable Mnemonics for sidepane actions - fixes #2224 --- .../java/net/sf/jabref/gui/SidePaneComponent.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/SidePaneComponent.java b/src/main/java/net/sf/jabref/gui/SidePaneComponent.java index c35143995029..97bebba6ce3f 100644 --- a/src/main/java/net/sf/jabref/gui/SidePaneComponent.java +++ b/src/main/java/net/sf/jabref/gui/SidePaneComponent.java @@ -6,7 +6,6 @@ import java.awt.event.ActionEvent; import java.awt.event.InputEvent; -import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -15,6 +14,8 @@ import javax.swing.JToolBar; import javax.swing.KeyStroke; +import net.sf.jabref.gui.actions.MnemonicAwareAction; + import org.jdesktop.swingx.JXTitledPanel; import org.jdesktop.swingx.painter.MattePainter; @@ -112,17 +113,18 @@ public Dimension getMinimumSize() { public abstract ToggleAction getToggleAction(); - public class ToggleAction extends AbstractAction { + public class ToggleAction extends MnemonicAwareAction { public ToggleAction(String text, String description, KeyStroke key, IconTheme.JabRefIcon icon){ - super(text, icon.getSmallIcon()); + super(icon.getIcon()); + putValue(Action.NAME, text); putValue(Action.ACCELERATOR_KEY, key); - putValue(Action.LARGE_ICON_KEY, icon.getIcon()); putValue(Action.SHORT_DESCRIPTION, description); } public ToggleAction(String text, String description, KeyStroke key, Icon icon){ - super(text, icon); + super(icon); + putValue(Action.NAME, text); putValue(Action.ACCELERATOR_KEY, key); putValue(Action.SHORT_DESCRIPTION, description); }