![]() |
![]() |
![]() |
![]() |
In this step, you will create a new custom control. You will also insert a method into the control that calls a method on one of the controls you imported earlier.
Through the preceding steps, you should have created the following two Java files in the controls folder:
These files contain only a default framework at this point. You will add a method in the following steps.
import model.Customer;
public Customer[] getLocalCustomers() { return customerControl.getCustomersByState("CA"); }
To correct this situation place the cursor anywhere in the name of the method (getLocalCustomers) and press Ctrl+1. Select Create in super type 'MailingListControl' and press Enter.
MailingListControl.java opens in the editor with the new method definition in place.
The getLocalCustomers method on this control uses the imported controls to query a sample database for all customers in a given state. In this example, we have hard-coded the state to be California. The data returned from the database is returned to the calling method as an array of Customer objects.
Click one of the following arrows to navigate through the tutorial:
![]() ![]() |