Blame view
src/main/kotlin/application/controller/TimePanel.kt
1.01 KB
3b26be8f9 controle the time... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
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<String?, Vessel>) { timeSlider.max = Vessel.maxTime.toDouble() timeSlider.min = Vessel.minTime.toDouble() } }) } private fun setSliderListener() { timeSlider.valueProperty().addListener { _, _, newValue -> observableCurrentTime.value = newValue.toInt() } } } |