JDK-7045184 : GTK L&F doesn't have hotkeys in jdk7 b141, while b139 has.
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2011-05-16
  • Updated: 2015-05-22
  • Resolved: 2011-06-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b145Fixed
Related Reports
Relates :  
Relates :  
Description
GTK L&F doesn't have hotkeys in jdk7 b141, while b139 has.



try testcase: 

import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public final class JOptionPaneTest extends JPanel {
    public static void main(final String[] args) throws Exception {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
        SwingUtilities.invokeAndWait(new Runnable() {
            @Override public void run() {
                JOptionPane.showInputDialog(null, "Alt+C close this dialog?");
            }
        });
    }
}

Comments
EVALUATION According to this doc (Dialog Box Design): http://java.sun.com/products/jlf/ed2/book/HIG.Dialogs2.html It states: OK and Cancel Buttons Do not add a mnemonic to the Cancel button. The Cancel button should be activated when users press the Escape key. The Cancel button does not need keyboard focus for this interaction. The Cancel button and its keyboard equivalent (Escape) are not built into the JFC; you must implement them yourself. Default Command Buttons Since the Enter (and Return) key is already supplied by the JFC for keyboard access, do not add a mnemonic for the default command button. Feedback from JFC team ###@###.###: don't think we should follow this instruction. The main concept in such situation is to be like a native LAF, if possible. Therefore if native GTK dialogs have mnemonics, we should keep them.
25-05-2011

WORK AROUND Workaround/solution is to use "Escape" to Cancel the dialog, and "Enter" to select the default key "OK".
24-05-2011

EVALUATION The change to remove mnemonics for OK and Cancel was done according to the evaluation of a related bug http://monaco.sfbay.sun.com/detail.jsf?cr=7018514 The OK and Cancel buttonsdo not have a mnemonics and shouldn't. OK is the default button, and therefore can be accessed by "Enter" key. Cancel is the Close button and therefore can be accessed by "ESC". etc.. etc.. Entry 1 andy.herrick [2011-02-17 16:31]
24-05-2011

EVALUATION In most of the java GUI dialogs (mostly deployment/install dialogs), by default, the hotkey for cancel is "escape" and hotkey for the default button is "enter". We tested using SwingSet2 demo and in GTK look and feel, we can "cancel" the dialog by clicking "escape". We removed the mnemonic key assignment because in Asian locales, we had to add (x) after the translated string to indicate the mnenonic key assignment. Our QA reported that the underline didn't show, that's why we removed the menonic assignments. Do you require us to add this back? or would clicking "escape" to dismiss the dialog work for you?
24-05-2011