From the course: Learning JavaFX GUI Development

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Lay out a user interface

Lay out a user interface

From the course: Learning JavaFX GUI Development

Start my 1-month free trial

Lay out a user interface

- [Voiceover] Have you ever tried to create a nice looking user interface using Java? In the past I'd have to say it was quite difficult to get your UI layout the way you wanted but I have great news. With the JavafX layout API it makes the process much easier, the Javafx.scene.layout API includes many different container classes which are called panes, that automate common layout models. Let's take a look at a few, the BorderPane lays out it's content in the top, bottom, right, left, and center region. The horizontal box class arranges its content nodes horizontally in a single row. And of course if we have horizontal we also have to have vertical. The vertical box lays out content vertically in a single column. The vertical box would be handy for a list of items or even a menu. I do want to point out the the horizontal box and the vertical box both prevent the window from being resized too small so you can't see the elements inside. Another layout is the StackPane, this class places…

Contents