JavaFX load images
Mar 6, 2024
Local image:
<ImageView
fx:id="imageView"
fitHeight="150.0"
fitWidth="200.0"
pickOnBounds="true"
preserveRatio="true"
>
<image>
<Image
url="/cat.jpg"
backgroundLoading="true"
/>
</image>
Load image from an URL:
<ImageView
fx:id="imageView"
fitHeight="150.0"
fitWidth="200.0"
pickOnBounds="true"
preserveRatio="true"
>
<image>
<Image
url="https://fastly.picsum.photos/id/1/300/300.jpg?hmac=w1b4AOJM9vszS0a867iY2NXBzwc4LCeA0U6sEjdlSDk"
backgroundLoading="true"
/>
</image>