我有问题。我将enter键设置为下一个焦点并触发jbutton,但是触发jbutton不起作用。
Set<AWTKeyStroke> set = new HashSet<AWTKeyStroke>(KeyboardFocusManager
.getCurrentKeyboardFocusManager().getDefaultFocusTraversalKeys(
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
set.add(KeyStroke.getKeyStroke("ENTER"));
KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalKeys(
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set);
UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);