Bean Introspection  «Prev  Next»
Lesson 9Building a basic JavaBean
ObjectiveHow do you Build and Test a basic Bean using Properties and Accessor Methods

How do you Build and Test a basic Bean using Properties and Accessor Methods

Building a basic JavaBean

Basic Bean Info
Up to this point in the course you've learned a lot about the composition of Beans and how Beans are organized. This module closes on a practical note by allowing you to build a basic Bean based on a lot of the things you've learned thus far. In this lesson, you build a Bean that displays a text label.
The basic Bean you build in this lesson, MyLabel, contains a single property called label that is displayed as the Bean's only graphical output.

This Bean can be used as an output control to display text. The MyLabel Bean consists of the following major parts:
  1. A label property
  2. Constructors for the Bean
  3. Accessor methods for the label property
  4. A paint() method to draw the label text

Basic Bean - Exercise

Click the Exercise link below to build the MyLabel Bean.
The next lesson concludes this module. In it, you review what you covered up to this point, and end with a short quiz.
Basic Bean Exercise