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



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net