package application.controller import application.model.* import javafx.fxml.FXML import javafx.fxml.Initializable import javafx.scene.control.Button import javafx.scene.control.Slider import java.net.URL import java.util.* class TimePanel : Initializable { @FXML var timeSlider = Slider() @FXML var timeStop = Button() @FXML var timePlay = Button() override fun initialize(location: URL?, resources: ResourceBundle?) { setSliderMinMax() setSliderListener() } private fun setSliderMinMax() { observableVessel.listeners.add(object : MessageListener{ override fun onValueChanged(newValue: MutableMap) { timeSlider.max = Vessel.maxTime.toDouble() timeSlider.min = Vessel.minTime.toDouble() } }) } private fun setSliderListener() { timeSlider.valueProperty().addListener { _, _, newValue -> observableCurrentTime.value = newValue.toInt() } } }