JavaBeans is a design pattern and a component architecture for Java. It is a set of rules for writing highly reusable software elements that can be understood by both developers and development tools. Writing components to the JavaBeans specification means your code will be easier to read and you won’t have to write as much custom code to glue components together. It also allows you to leverage JavaBean-aware development environments that can recognize the features of these components automatically and connect them in a plug-and-play fashion to build parts of applications.
In this chapter, we’ll use the NetBeans IDE to create simple applications by connecting Java beans visually. We will also create our own reusable beans to add to the palette of components in the IDE. Although this type of visual application design has never quite reached the level it was expected to (we’ll talk about some of the reasons why later), it is still very useful in GUI development. Perhaps more important though, the fundamental JavaBeans patterns are firmly entrenched in all aspects of the core Java APIs, so understanding them is important. We will cover all of these aspects in this chapter, including hand-coding with Java beans and some related APIs.
Get Learning Java, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.