-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclear how to use addKeyDown/Up/PressListener #4046
Comments
As the author of the PR which introduced these notifiers, I can say that:
Thus the choice to use I totally agree the JavaDocs should be more clear about this. |
@heruan - what do you think about the following to allow easier discovery of "Key".
Dunno if this could be a way the Flow Team likes to handle stuff. |
Wouldn’t this be just overhead? Instead of this:
You’d have this:
I don’t see any added value, am I missing something? I really think it’s just a matter of JavaDocs here. |
The benefit would be discoverability, i.e. that your IDE will offer better auto complete suggestions. As an alternative to an enum, I would suggest an interface with constants and a static
Another alternative would be to have two separate overloads of |
KeyNotifier.addKeyDownListener(String key, ComponentEventListener<KeyDownEvent> listener, KeyModifier... modifiers)
javadoc saysWhat remains unclear is:
addKeyDownListener("abc",...)
?key to match
, which was quite unexpected. Especially as "enter" does not work. There is seemingly no way to know upfront if I should useesc
,Esc
,escape
orEscape
to match the escape keyI would have expected the
key
parameter to be a a character and13
would listen to enterThe text was updated successfully, but these errors were encountered: