Chapter 12. Enhanced looks
This chapter covers
- Adding custom nodes to views
- Using third-party view extensions
Views draw the user’s attention, either by how they look or how they behave. It doesn’t matter if you’re a newcomer to Java Swing or a seasoned expert—there will be times when the standard widget set exposed by the JDK isn’t enough to create a compelling user interface or to provide an incredible experience.
Fortunately, Swing components are extensible. There are multiple third-party components out there—some commercial, some open source. You can also change how standard and custom components look by applying new Look & Feel classes. If you don’t know what “Look & Feel” means in Swing, think of themes and skins.
In this chapter, you’ll learn how views can be extended by registering additional nodes that will handle custom components. You’ll also learn how the view build process can be modified at specific points. Finally, we’ll enumerate and explain some of the official SwingBuilder extensions harbored by the Griffon project.
You now know that SwingBuilder is a thin abstraction layer over Java Swing. This layer only covers the standard set of Swing components. Or does it? There are ways to register custom components directly on views (remember widget(), container(), and bean() from chapter 4?). There’s also the option to register factories in an addon (as seen in the previous chapter), which requires you to build and package an addon.