JFXSlider未正确呈现

时间:2017-03-26 21:54:16

标签: java javafx

我的滑块在每个其他窗格中呈现得非常精细,但是在我的HBox中,下半部分没有着色,好像滑块没有超过这一点。

This is how it looks

public class VSlider extends JFXSlider {
    private final int id;
    private final OSCDistributionController con;

    public VSlider(ReadOnlyDoubleProperty height, OSCDistributionController con, int id) {
        super();
        this.setOrientation(Orientation.VERTICAL);
        this.con = con;
        this.id = id;


        setPadding(new Insets(20, 10, 40, 10));
        height.addListener(new ChangeListener<Number>() {     //Höhe dynamisch anpassen
            public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
                setPrefHeight(newValue.doubleValue());
            }
        });

        setOnTouchMoved(new EventHandler<TouchEvent>() {
            public void handle(TouchEvent event) {
                setPressed(true);
                setValue(100 / getHeight() * (getHeight() - event.getTouchPoint().getY()));
                setPressed(false);
                con.eventSlider(id, (int) getValue());
            }
        });
        valueProperty().addListener((observable, oldValue, newValue) -> {
            if (isValueChanging()) {
                con.eventSlider(id, newValue.intValue());
            }
        });
        con.registerSlider(this, id);   //Im Controller registrieren

    }
}

0 个答案:

没有答案