Rajat Khandelwal
Rajat Khandelwal

Reputation: 487

how to position a button in HBox - JAVAFx

I am new to JAVAfx, i trying to code a web browser. The problem i am facing is :- i want to place the button present on the Bottom left of the screen to the bottom right.

I am trying this code but it is not working. Somebody please help

Button Developer = new Button(); 
Developer.setAlignment(Pos.BOTTOM_RIGHT);

here is the screenshot: https://i.sstatic.net/4RTpr.png

Thanks

Upvotes: 0

Views: 7251

Answers (1)

Marcel Gwerder
Marcel Gwerder

Reputation: 8520

You should be able to set the alignment on the HBox instead of the Button itself.

Button developer = new Button(); 

HBox hbox = new HBox();
hbox.setAlignment(Pos.BOTTOM_RIGHT);
hbox.getChildren().add(developer);

Upvotes: 3

Related Questions