java-Vaadin中的ENTER快捷键和TextArea
作者:互联网
TextField f = new TextField();
Button b = new Button("Save");
b.setClickShortcut(KeyCode.ENTER); // For quick saving from text field itself
TextArea longText = new TextArea(); // "Enter" is garbled here
是否热衷于使快捷方式仅在“发件人”文本字段中起作用?
解决方法:
使用焦点和模糊侦听器删除并添加快捷键:
f.addFocusListener(new FocusListener() {
@Override
public void focus(FocusEvent event) {
b.setClickShortcut(KeyCode.ENTER);
}
});
f.addBlurListener(new BlurListener() {
@Override
public void blur(BlurEvent event) {
b.removeClickShortcut();
}
});
标签:vaadin7,java,keyboard-shortcuts,vaadin 来源: https://codeday.me/bug/20191011/1889475.html