Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

Generating JavaBeans Component Code

The IDE has a few levels of support for creating JavaBeans components. You can use the following features:

  • Code completion. When you have a field in your class without a corresponding get or set method, you can generate that method by pressing Ctrl-Space and choosing the method from the code completion box.
  • Refactor | Encapsulate Fields command. You can use this command to generate get and set methods, change the field's access modifier, and update code that directly accesses the field to use the getters and setters instead.
  • Bean Patterns node. In the Projects window, each class has a subnode called Bean Patterns as shown in Figure 5-9. You can right-click this node and choose from a variety of commands that enable you to generate code for bean properties, property change support, and event listening. In addition, you can generate BeanInfo classes.

    Figure 5-9 Bean Patterns node and menu

  • + Share This
  • 🔖 Save To Your Account