Example usage for javafx.util Duration divide

List of usage examples for javafx.util Duration divide

Introduction

In this page you can find the example usage for javafx.util Duration divide.

Prototype

@Deprecated
public Duration divide(Duration other) 

Source Link

Document

Divide this instance by another Duration to return the ratio.

Usage

From source file:MediaControl.java

protected void updateValues() {
    if (playTime != null && timeSlider != null && volumeSlider != null) {
        Platform.runLater(new Runnable() {
            public void run() {
                Duration currentTime = mp.getCurrentTime();
                playTime.setText(formatTime(currentTime, duration));
                timeSlider.setDisable(duration.isUnknown());
                if (!timeSlider.isDisabled() && duration.greaterThan(Duration.ZERO)
                        && !timeSlider.isValueChanging()) {
                    timeSlider.setValue(currentTime.divide(duration).toMillis() * 100.0);
                }//from w w w .  jav  a 2 s.  c  o m
                if (!volumeSlider.isValueChanging()) {
                    volumeSlider.setValue((int) Math.round(mp.getVolume() * 100));
                }
            }
        });
    }
}