Adding a search feature to the application
Finally, we will create a second query, this one allowing us to search for a particular item in the inventory database.
To start, you will add a few more items to the user interface.
- Select the border layout as you did previously, by right clicking on a component, choosing 'border1'.
- Click on "Show empty panels" to show the remaining empty spaces in it.
- From the 'Layouts' page of the palette, select 'Flow'.
- Click once on the "South" empty space of the border layout.
- From the 'Swing' page of the palette, select 'Button' (JButton).
- Click once in the empty space of the Flow you just created.
- From the 'Swing' page of the palette, select 'TextField' (JTextField).
- Click once in the Flow Layout to add a JTextField.
- Choose "Hide all empty panels" from the parts menu.
Next you will set up the properties of the items you created.
- Click once on the button you just created.
- Change the Object name to "searchFor".
- Change the JButton text to "Search for:".
- Click once on the JTextField you just created.
- Change the Object name to "nameToSearchFor".
- Set the Number of columns to 20.
- Set the JTextField text to be blank.
You have now made the final additions to the user interface of your application.
| Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |