< Previous | Next >

Lesson 2.8: Set up a filter on the employees table

You can use a Text Filter Binder to filter the contents of the employees table. The filter takes input from a text field, and filters the table based on a particular property, or column, in the table.

In the application, you will use the characters entered in the Filter field to filter by employee last name. If the exact values entered in the Filter field are present in the last name of an employee record, the employee record will display in the table.

Screen shot of table being filtered

To create a filter for the table:

  1. Select the binder icon for the employeesTable and select Filter Binding Properties. The Filter Binding dialog box opens.
  2. In the Text field for the filter input list, select filterField.
  3. In the Table property to be filtered list, select lastName.

    Filter Binding dialog box for employeesTable

  4. Click OK.
A new SwingPropertyFilter is generated. The filter property on the table's binder is set to use the new filter. The new filter is configured to use the Filter field for its input, and to filter on the lastName property of the table.

Lesson checkpoint

In this lesson you learned how to set up a filter for a table.

Now, when you run the My Company Directory application, you can type characters in the Filter field, and the table will be filtered to show the rows where the last name contains the characters entered.

Congratulations! The My Company Directory application is finished.

< Previous | Next >