Handling Enter key presses on Buttons in JavaFX

Richard Bair richard.bair at oracle.com
Wed Jun 8 16:59:56 UTC 2016

>>> 2) Do we want to have different behaviors for OS X and non-OS X? I'm a
>>> newly inducted member into the cult of Mac, and I don't yet have all
>>> my bearings sorted out, so I don't have a strong opinion here.
>> Please don't make different OSes behave differently as this is a real pain. I would much prefer, if JavaFX-Applications behave the same on all platforms.
> That ship has already sailed. I think it it's the right thing to do. Mac users want a screen menu bar and they want the okay and cancel buttons to be in the correct place in dialogs.
> Respect the conventions and UI guidelines of the platform.

Agreed. Our philosophy was always to have a platform “feel” but cross platform “look”. This is vitally important, because people on a particular platform are used to certain behaviors, and if an app behaves completely differently it will be considered broken and (in cases like the one Jonathan mentions regarding “enter” on dialogs) can have adverse business effects on people. Drawing a button with a different shadow is one thing (and branding it that way across all platforms), but having different keystrokes is bad.

The right thing to do (IMO) is to carefully document the native platform’s behavior and match it when running on that platform. It is difficult and time-consuming, but necessary for end users to be satisfied with the result. The more FX can shoulder the burden of having platform-specific feel so that developers are free to focus on their app and not this level of detail, the better.


More information about the openjfx-dev mailing list