-1

this is a possible duplicate of this question but as it wasn't answered or the provided answers didn't satisfy my needs i had to post a new question here, so how do i set the padding value to a javaFX node to only one side without having to specify padding values for the other sides, better if through CSS, thank you.

SDIDSA
  • 894
  • 10
  • 19
  • 3
    I don't know If I truly understand the question. Are you saying `Insets(double top, double right, double bottom, double left)` does not work because you have to set zero in values other than the right padding? – SedJ601 May 10 '19 at 16:50
  • 4
    You cannot set the paddings seperately. There is only [a single property](https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/layout/Region.html#paddingProperty) for all paddings. You'll need to create a copy of the `Insets` already in use with one of the paddings modified... – fabian May 10 '19 at 16:52
  • 1
    Possible duplicate of [How to set only a top padding in JavaFX](https://stackoverflow.com/questions/30458972/how-to-set-only-a-top-padding-in-javafx) – Matt May 10 '19 at 17:43

1 Answers1

0

after fabian pointed out that there is no way to specify one side without affecting other sides as the padding is a single property, that's the solution that i came up with, which worked for my specific case and i hope someone finds this useful

Insets old = region.getPadding();
int rightPadding = 45;
region.setPadding(new Insets(old.getTop(), rightPadding , old.getBottom(), old.getLeft()));
SDIDSA
  • 894
  • 10
  • 19