-fx-padding
is a characteristic of a Region.
An ImageView
does not fall under the Region category, therefore, direct use of padding on an ImageView is not possible. However, you can place the ImageView within a Region to create a padded area around it.
Here's an example that utilizes a StackPane (which is a style-capable region). The padding is defined in FXML, but could also be implemented using CSS.
https://i.sstatic.net/LmzJ5.png
In this example, the green border surrounding the image represents the padding.
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<StackPane id="StackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" style="-fx-background-color: forestgreen;" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="http://www.corwellphotography.net/image/2223982.jpeg" />
</image>
</ImageView>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</StackPane>
Since a StackPane or Region has the ability to contain various types of nodes, this technique can be applied to any kind of node (not limited to ImageViews).