Reputation: 5
I want to specify spacing between two elements within JavaFX Buttons, Here is the Code :
ImageView fiv = new ImageView(new Image("/modified/map.png"));
fiv.setFitHeight(20);
fiv.setPreserveRatio(true);
Button cr = new Button( "Crop", fiv);
Here I want to Specify Spacing Between "Crop" and fiv, How can i do this ?
Upvotes: 0
Views: 924
Reputation: 6079
As stated already, you can call the setGraphicTextGap()
method to adjust the gap:
btnSaveUser.setGraphicTextGap(8.0);
I prefer to define my styles in an external CSS file, however.
If anybody is looking for a FXML equivalent, here it is:
.btnSaveUserClass {
-fx-graphic-text-gap: 8.0;
}
The style class btnSaveUserClass
must be applied to a button in the FXML file:
<Button fx:id="btnSaveUser" mnemonicParsing="true" text="_Save user"
styleClass="btnSaveUserClass" onAction="#onSaveUserAction"/>
Upvotes: 0