Nicklas2
(Nicklas Karlsson)
1
Is there some special magic required for listening on the numpad ‘+’?
I’m trying to use + for adding one to a number in a TextField but with the below sample, I only get a reaction from the Enter key…
field.addKeyPressListener(Key.ENTER, e -> {
Notification.show("Enter");
});
field.addKeyPressListener(Key.ADD, e -> {
Notification.show("Plus");
});
Nicklas2
(Nicklas Karlsson)
2
I can do a generic
field.addKeyPressListener(e -> {
if (e.getKey().getKeys().iterator().next().equals("+")) {
Notification.show("+");
}
});
which works (and shows that it’s a different key from Key.ADD)
Nicklas2
(Nicklas Karlsson)
4
Ah, I’ll have a look. A bit confusing when Key.ADD has the description “The numeric keypad’s addition key, +.”