Blame view
src/main/kotlin/application/controller/TimePanel.kt
1.07 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 |
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() { |
78935bd62 slider bind to al... |
32 33 |
timeSlider.min = 0.0 timeSlider.max = 0.0 |
3b26be8f9 controle the time... |
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
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() } } } |