ComboBox not working with touch screen

thomas.manz+JFX at thomas.manz+JFX at
Wed Aug 26 10:07:25 UTC 2020

first of all I´m really sorry for this long email, esp. because it´s not as
constructive as I would wish - nevertheless I hope you are interested enough
to read it. Just a get a coffee before... ;)
I´m still working on a JavaFX project for a RaspberryPi and a 7" touch
screen. For selecting an option from a list of about 5 - 20 items I decided
to use a ComboBox. Now while this was working rather well on one hardware
(i. e. in about 8 out 10 tries) it is absolutely unusable on a second one!
When tapping the ComboBox the dropdown list opens fine, but when you tap on
one of the items then the dropdown list closes without any item being
selected (or changed if another was already selected before). Only in one of
about 10 tries it works and the item will be selected.
I think the root cause of the issue consists of actually two issues, this is
what I found out so far:
There would be two options to use the ComboBox: setting
"" to TRUE or FALSE.
Setting it to FALSE does not allow to scroll the dropdown list at all using
a touch screen because no ScrollBar is shown (even with setting
"-Dcom.sun.javafx.isEmbedded" to FALSE) - so this is not an option. (I don´t
know if this could be an intended usage.)
Now setting it to TRUE allows scrolling by "finger down" anywhere on the
dropdown list - move finger - "finger up". Great, but here´s the first
issue: with "finger up" the dropdown list closes immediately, no chance to
select anything! The only good thing here is that when opening the ComboBox
again we are still at the new scrolling position and could scroll further or
select an item. I would rate this as super annoying (and actually a bug) but
it´s somehow usable. On Windows the behavior with "pannable=true" is a
little bit different: similarly there is no ScrollBar but you still can
scroll the list with "mouse button down" on the list - move the mouse -
"mouse button up" and also here the dropdown list closes immediately after
"mouse button up" but here already with "mouse button down" the item on that
position is selected. So a little bit weird behavior but maybe it also was
never intended to use pannable=TRUE with a mouse.
Now the second issue that makes the ComboBox completely unusable is Monocle
in combination with the hardware - it seems that my second touch screen is a
little bit more sensitive. The consequence is that on that touch screen it´s
barely possible to do a simple "tap" = "click" - nearly always Monocle will
recognize it as a "finger down" - "move finger by 1 or 3 pixel" - "finger
up". I guess you see it coming already: on the sensitive touch screen
whenever you just want to do a "click" to select an item then the ComboBox
is recognizing it as a scroll and because of the first issue the dropdown
closes and nothing is selected.
For your convenience I copied the relevant code from,
lines 170 - 192 at the bottom: if you know that MouseEvent.isSynthesized()
will only be TRUE with Monocle and a touch screen you´ll understand the
above described behavior and the different behavior in Windows or when using
a mouse.
I guess the intended solution for this is setting
"-Dmonocle.input.touchRadius" to an appropriate value and as soon as I
actually set it to 4 or 5 it´s working. But there is still the first issue
with "immediate close after scrolling" what is a bug in my opinion, I´m not
sure if you agree.
Additionally I´m not a big fan of increasing the touchRadius: even with
setting it to 1 on the very sensitive touch screen all the other controls
work perfectly fine and setting it to 5 would waste resolution for Controls
like ScrollBar or Slider, they are becoming "jumpy" and so it really would
be a pity to do that.
Unfortunately here I cannot think of a good solution: the only that came to
my mind was to ignore the MouseEvent.isSynthesized(), put a (configurable)
threshold directly in CellBehaviorBase and decide there when it´s a scroll
or just a "slippy tap". But to be honest even I don´t think that this is a
good solution from architectural point of view.
Here I really miss lots of your experience to come up with a better
solution, I´m still a newbie in JavaFX development so I hope you guys can
provide better ideas and approaches to fix it in a way that preserves the
user experience with all Controls on a touch screen!
Thanks a lot for reading and keep continuing your great work, I really
appreciate it!
Best regards,
Thomas, lines 170 - 192:
    public void mousePressed(MouseEvent e) {
        if (e.isSynthesized()) {
            latePress = true;
        } else {
            latePress  = isSelected();
            if (!latePress) {
                doSelect(e.getX(), e.getY(), e.getButton(),
                        e.isShiftDown(), e.isShortcutDown());
    public void mouseReleased(MouseEvent e) {
        if (latePress) {
            latePress = false;
            doSelect(e.getX(), e.getY(), e.getButton(), e.getClickCount(),
                    e.isShiftDown(), e.isShortcutDown());
    public void mouseDragged(MouseEvent e) {
        latePress = false;

More information about the openjfx-dev mailing list