Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering JavaFX 10

You're reading from  Mastering JavaFX 10

Product type Book
Published in May 2018
Publisher Packt
ISBN-13 9781788293822
Pages 268 pages
Edition 1st Edition
Languages
Author (1):
Sergey Grinev Sergey Grinev
Profile icon Sergey Grinev
Toc

Table of Contents (15) Chapters close

Preface 1. Stages, Scenes, and Layout 2. Building Blocks – Shapes, Text, and Controls 3. Connecting Pieces – Binding 4. FXML 5. Animation 6. Styling Applications with CSS 7. Building a Dynamic UI 8. Effects 9. Media and WebView 10. Advanced Controls and Charts 11. Packaging with Java9 Jigsaw 12. 3D at a Glance 13. What's Next? 14. Other Books You May Enjoy

Fluid layouts

Despite all the listed practices, you can only shrink elements so much. So the next option will be to rearrange them once space becomes a bigger issue.

The easiest thing to adapt is text. It can be naturally split into words into separate lines saving width at the price of height. Most controls which contain text support wrapText property to control that behavior.

Default button behavior is to show ellipses (...) if the text is too long. It can be changed using wrapTextProperty() value:

For other nodes, similar behavior is provided by the FlowPane layout manager.

Note that it doesn't work ideally for all configurations and fluid UI structure may confuse users. Property pages are one convenient example, as shown in the following screenshot:

To create such a UI, we use FlowPane and populate it with properties:

// chapter7/resizing/FlowLayoutDemo.java
FlowPane...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}