Chapter 5. Organizing Components
This chapter covers
- Learning the various layout systems
- Exploring the Layout class inheritance model
- Exercising programmatic management of the CardLayout
When building an application, many developers struggle with how to organize their UI and which tools to use to get the job done. In this chapter, you’ll gain the necessary experience to be able to make these decisions in a more educated manner. We’ll explore all of the numerous layout models and identify some of the best practices and common issues that you’ll encounter.
The layout management schemes are responsible for the visual organization of widgets onscreen. They include simple layout schemes such as Fit, where a single child item of a Container will be sized to fit the Container’s body, or complex layouts such as a BorderLayout, which splits a Container’s content body into five manageable slices, or regions.
When exploring some of the layouts, we’ll hit upon examples that are verbose, and thus lengthy, and can serve as a great springboard or starting point for your layout endeavors. We’ll start our journey with taking a look at the ContainerLayout, which is the nucleus of the entire layout hierarchy.