dlsc-software-consulting-gmbh / GemsFX

A collection of JavaFX controls and utilities.
Apache License 2.0
436 stars 51 forks source link

Duplicate Components Added on Separator Property Changes in TimerPickerSkin Causes IllegalArgumentException #127

Closed leewyatt closed 1 month ago

leewyatt commented 1 month ago

Changing separator properties causes the same components to be added multiple times to fieldsBox and getChildren(), resulting in a java.lang.IllegalArgumentException: Children: duplicate children added error.

        InvalidationListener buildViewListener = it -> buildView();

        picker.hoursSeparatorProperty().addListener(buildViewListener);
        picker.minutesSeparatorProperty().addListener(buildViewListener);
        picker.secondsSeparatorProperty().addListener(buildViewListener);

        buildView();

    private void buildView() {
        // ...
        fieldsBox.getChildren().addAll(hourField, hoursSeparator, minuteField, minutesSeparator, secondField, secondsSeparator, millisecondField);
        // ...
        getChildren().add(box);
    }