I would like to include buttons with icon and text using FXML.
I know that in FXML I can add an image with the following code:
<ImageView id="boxImage" fitWidth="100" fitHeight="100">
<image>
<Image url="@/com/example/app/resources/icons/office.png" />
</image>
</ImageView>
But I am wondering how to merge that with a button code:
<Button text="DATE"/>
Any help or example is really welcomed as I am totally lost on how to apply an image using FXML.
Edit
Following answers I did:
<Button text="INSTRUMENT" styleClass="">
<graphic>
<ImageView pickOnBounds="true" preserveRatio="true">
<image>
<Image url="/com/example/app/resources/icons/instrument.png" />
</image>
</ImageView>
</graphic>
</Button>
But I get:
The button increases its height and therefore is no longer aligned with the other buttons without images.