Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ImageView

[35:7] extends: Node

Wraps JavaFX ImageView, a node that displays an Image with optional scaling and aspect-ratio control. The image source can be provided as an Image object, a URL string, or null for no image. ImageView extends Node directly and does not support Region or Shape CSS properties.

CSS Properties -- Node

Property Values Default Description
-fx-blend-mode add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over null Blend mode used when compositing this node with nodes beneath it.
-fx-cursor null | crosshair | default | hand | move | e-resize | h-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | v-resize | text | wait | <url> null (inherits) Mouse cursor shape shown when the pointer is over this node. Inherits from parent by default.
-fx-effect <effect> null A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node.
-fx-focus-traversable true | false false Whether this node participates in focus traversal.
-fx-view-order <number> 0 Adjusts rendering and hit-test order within the parent without changing the scene graph order.
-fx-opacity <number> [0.0 - 1.0] 1 Opacity of the node. 0 is fully transparent, 1 is fully opaque.
-fx-rotate <number> 0 Rotation angle in degrees applied around the node's center point.
-fx-scale-x <number> 1 Scale factor along the X axis about the node's center.
-fx-scale-y <number> 1 Scale factor along the Y axis about the node's center.
-fx-scale-z <number> 1 Scale factor along the Z axis about the node's center.
-fx-translate-x <number> 0 Translation offset along the X axis in pixels.
-fx-translate-y <number> 0 Translation offset along the Y axis in pixels.
-fx-translate-z <number> 0 Translation offset along the Z axis in pixels.
visibility visible | hidden | collapse | inherit visible Controls whether the node is rendered and participates in layout.
-fx-managed true | false true When false, the parent layout does not manage this node's position or size.

Methods

  • ImageView (Image = null)

    Creates a new ImageView object with either an Image object, a string URL, or null for no image.

    • @p Image An Image object, URL string, or null.
    • @r this object
  • adopt (object Ajo)

    Wraps an existing javafx.scene.image.ImageView AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a javafx.scene.image.ImageView.
    • @r A new ImageView wrapper.
  • setImage (object Image)

    Sets the image for the ImageView.

    • @p Image An Image object to display in the ImageView.
    • @r this object for chaining
  • getImage ()

    Returns the currently displayed Image as an AussomJavaObject.

    • @r An AussomJavaObject around the javafx.scene.image.Image, or null.
  • imageProperty ()

    Returns the image property for this ImageView.

    • @r An ObjectProperty AussomJavaObject.
  • setX (double X)

    Sets the X coordinate of the upper-left corner where the image is drawn.

    • @p X is a double with the X coordinate in pixels.
    • @r this object
  • getX ()

    Returns the X coordinate of the upper-left corner of the image.

    • @r A double with the X coordinate.
  • xProperty ()

    Returns the x property for this ImageView.

    • @r A DoubleProperty AussomJavaObject.
  • setY (double Y)

    Sets the Y coordinate of the upper-left corner where the image is drawn.

    • @p Y is a double with the Y coordinate in pixels.
    • @r this object
  • getY ()

    Returns the Y coordinate of the upper-left corner of the image.

    • @r A double with the Y coordinate.
  • yProperty ()

    Returns the y property for this ImageView.

    • @r A DoubleProperty AussomJavaObject.
  • setFitWidth (double W)

    Sets the width to which the image is scaled when displayed.

    • @p W is a double with the fit width in pixels; 0 uses the image's natural width.
    • @r this object
  • getFitWidth ()

    Returns the current fit width in pixels.

    • @r A double with the fit width.
  • fitWidthProperty ()

    Returns the fitWidth property for this ImageView.

    • @r A DoubleProperty AussomJavaObject.
  • setFitHeight (double H)

    Sets the height to which the image is scaled when displayed.

    • @p H is a double with the fit height in pixels; 0 uses the image's natural height.
    • @r this object
  • getFitHeight ()

    Returns the current fit height in pixels.

    • @r A double with the fit height.
  • fitHeightProperty ()

    Returns the fitHeight property for this ImageView.

    • @r A DoubleProperty AussomJavaObject.
  • setPreserveRatio (bool Preserve)

    Sets whether the image's original aspect ratio is preserved when scaling.

    • @p Preserve is a bool; when true the image is scaled uniformly to fit within the fit dimensions.
    • @r this object
  • isPreserveRatio ()

    Returns whether the image's aspect ratio is preserved.

    • @r A bool with the current preserveRatio setting.
  • preserveRatioProperty ()

    Returns the preserveRatio property for this ImageView.

    • @r A BooleanProperty AussomJavaObject.
  • setSmooth (bool Smooth)

    Sets whether a higher-quality filtering algorithm is used when scaling the image.

    • @p Smooth is a bool; when true bilinear interpolation is used instead of nearest-neighbor.
    • @r this object
  • isSmooth ()

    Returns whether high-quality filtering is enabled when scaling.

    • @r A bool with the current smooth setting.
  • smoothProperty ()

    Returns the smooth property for this ImageView.

    • @r A BooleanProperty AussomJavaObject.
  • setViewport (object Viewport)

    Sets the rectangular viewport into the source image; only the area inside this rectangle is drawn.

    • @p Viewport is a Rectangle2D AussomJavaObject defining the viewport, or null for the full image.
    • @r this object
  • getViewport ()

    Returns the current viewport rectangle, or null when no viewport is set.

    • @r A Rectangle2D AussomJavaObject, or null.
  • viewportProperty ()

    Returns the viewport property for this ImageView.

    • @r An ObjectProperty AussomJavaObject.
  • getCssMetaData ()

    Returns the CSS metadata for this ImageView's styleable properties.

    • @r A List AussomJavaObject of CssMetaData entries.