滚动条事件中的旧值

时间:2016-02-07 18:41:51

标签: events javafx scrollbar

我有一个垂直滚动条。当它调整大小时触发一个事件,检查它是100%或更多来隐藏它,而是获得新的大小值只是得到旧的。可见性更改为OK但不是大小:

scrollBarL.heightProperty().addListener((ObservableValue<? extends Number> ov,
                                                        Number old_val, Number new_val) -> {    

if (scrollBarL.getVisibleAmount() >= 1 ) {              
           scrollBarL.setMaxWidth(0);    // Not change width immediately
           scrollBarL.setPrefWidth(0);   // Not change width immediately
           scrollBarL.setMinWidth(0);    // Not change width immediately             
           scrollBarL.setVisible(false); // OK. Change visibility immediately
   } else {           
           scrollBarL.setMaxWidth(19);   // Not change width immediately
           scrollBarL.setPrefWidth(19);  // Not change width immediately
           scrollBarL.setMinWidth(19);   // Not change width immediately
           scrollBarL.setVisible(true);  // OK. Change visibility immediately
        }
    });           

0 个答案:

没有答案