Asperger
Asperger

Reputation: 3222

java align an HBox to the bottom left

I dont want to use a gridpane.

So I have an HBox:

HBox fooBar = new HBox();

fooBar.setHeight(100);
fooBar.setWidth(100);
fooBar.setAlignment(pos.BOTTOM_LEFT);

I gave it a color in css.

I include it into my scene and for some reason the box stays stuck on the bottom left corner. Is there any way to position it?

I forgot to mention: this hbox is the child of another hbox where I didnt define any position or dimension.

Upvotes: 0

Views: 2060

Answers (1)

BadVegan
BadVegan

Reputation: 494

Hbox is a component which determine position own children. If you want change position you should change alignment property in parent. It impact for all children. You couldn't change position for one child. All children have to be obedient. You can use Pane for absolute positioning. enter image description here

enter image description here

Upvotes: 1

Related Questions