Hi,

My JavaFX program updates API objects in the background via a non FX thread that, when changed by another program, are reflected in my JavaFX GUI's controls by property binding, specifically TableView, Slider, TextField, and ComboBox. Problem is, while JavaFX is OK with this for TableView, Slider, and TextField, it throws a Not on FX application thread exception *only* for the ComboBox.


The code for the slider looks like this:

    private class ValueListener implements ChangeListener<Integer>
    {
        @Override
        public void changed(ObservableValue<? extends Integer> observable, Integer oldValue, Integer newValue)
        {
            slider.getSlider().setValue(newValue);
            slider.getTextBox().setText(newValue.toString());
        }
    }


(the slider variable is misleading, it's actually a VBox that contains a Slider and a TextField. Need to change it but I digress.)


which works fine. However this:


    private class ValueListener implements ChangeListener<E>
    {
        @Override
        public void changed(ObservableValue<? extends E> observable, E oldValue, E newValue)
        {
            combo.setValue(newValue);
        }
    }


doesn't for the ComboBox.


Is this a bug or is there some legitimate invisible reason as to why the slider/textfield isn't throwing an error but the combobox one is?



Reply via email to