class ImageDisplay extends AnyRef
Displays an image view with ability to zoom in, zoom out, zoom to fit. It can also automatically resizes to parent size.
When zoomToFit
is set to true
the image is sized to fit the parent scroll pane.
Sample usage (full detains in ImageDisplayDemoApp
)
object ImageDisplayDemoApp extends JFXApp3 { override def start(): Unit = { private val imageDisplay = new ImageDisplay() stage = new PrimaryStage { scene = new Scene(640, 480) { title = "ImageDisplay Demo" root = new BorderPane { top = new ToolBar { items = Seq( new Button("Open...") { onAction = () => onFileOpen() }, new Button("Zoom In") { onAction = () => imageDisplay.zoomIn() disable <== imageDisplay.zoomToFit }, new Button("Zoom Out") { onAction = () => imageDisplay.zoomOut() disable <== imageDisplay.zoomToFit }, new ToggleButton("Zoom to fit") { selected <==> imageDisplay.zoomToFit } ) } center = imageDisplay.view } } } } }
- Source
- ImageDisplay.scala
- Alphabetic
- By Inheritance
- ImageDisplay
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ImageDisplay()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val actualZoom: ReadOnlyDoubleProperty
Actual zoom value.
Actual zoom value. It should be the same as
zoom
whenzoomToFit==false
, it may be different ifzoomToFit==true
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val image: ObjectProperty[Image]
Property containing image to be displayed.
Property containing image to be displayed. If
null
the display will be blank (following JavaFX convention) - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val roi: ObjectProperty[Option[Rectangle]]
Optional rectangular ROI to be displayed on the image
- def rotation: Double
Image rotation in degrees.
Image rotation in degrees. Default value is 0 (no rotation).
- def rotation_=(r: Double): Unit
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- val view: Node
ScalaFX node in containing this image display UI.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- val zoom: ObjectProperty[ZoomScale]
Controls image zoom when
zoomToFit
is off.Controls image zoom when
zoomToFit
is off. Value of 1 mean no scaling. Values larger than 1 make image larger. Values smaller than 1 make image smaller. - def zoomIn(): Unit
Zoom in the view.
- def zoomOut(): Unit
Zoom out the view.
- val zoomToFit: BooleanProperty
When set to
true
the image fits to the size of the available view, maintaining its aspect ratio.
Helper methods and classes to simplify ScalaFX use.
Package
org.scalafx.extras
contains basic helper methods for running tasks on threads and showing messages.Package
org.scalafx.extras.image
contains image display component with scrolling and zooming.Package
org.scalafx.extras.mvcfx
contains classes for creating with UI components based on FXML.