11/*
2- * Copyright (c) 2011-2022 , ScalaFX Project
2+ * Copyright (c) 2011-2024 , ScalaFX Project
33 * All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,7 @@ import org.scalafx.extras.ShowMessage
3232import scalafx .Includes .*
3333import scalafx .application .JFXApp3
3434import scalafx .application .JFXApp3 .PrimaryStage
35+ import scalafx .collections .ObservableBuffer
3536import scalafx .scene .Scene
3637import scalafx .scene .control .*
3738import scalafx .scene .image .Image
@@ -43,6 +44,8 @@ import scalafx.stage.FileChooser
4344 */
4445object ImageDisplayDemoApp extends JFXApp3 {
4546
47+ private val rotationItems = ObservableBuffer (0 , 90 , 180 , 270 )
48+
4649 override def start (): Unit = {
4750
4851 val imageDisplay = new ImageDisplay ()
@@ -68,6 +71,13 @@ object ImageDisplayDemoApp extends JFXApp3 {
6871 },
6972 new ToggleButton (" Zoom to fit" ) {
7073 selected <==> imageDisplay.zoomToFit
74+ },
75+ new ChoiceBox (rotationItems) {
76+ selectionModel().selectedItem.onChange { (_, _, newValue) =>
77+ println(s " $newValue chosen in ChoiceBox " )
78+ imageDisplay.rotation = newValue
79+ }
80+ selectionModel().selectFirst()
7181 }
7282 )
7383 }
0 commit comments