Resetable Components

If you use components in a search form then you will typically want to be able to reset the values in the criteria boxes to some default value. Typically this would be some default value for a combo box or blank for a text field. To simplify this Tamarin provides Resetable Components. A Resetable Component is a JComponent that implements the Resetable interface. To implement this the component implements the reset() method. On a search form, the Reset button then calls the reset methods of these components. In this example, when the user clicks Reset, all the text fields are reset to empty and the combo box defaults to the first item, 2.

	
    Object[] doorItems = new String[]{"2", "3", "4", "5"}; 

    // Create a new search form with 1 column
    SearchForm form = new SearchForm("Resetable Component Example", 1, mySearchAction);
    form.addResetableItem("Make : ", new ResetableTextField(20));
    form.addResetableItem("Model : ", new ResetableTextField(25));
    form.addResetableItem("Minimum Price : ", new ResetableTextField(15));
    form.addResetableItem("Maximum Price : ", new ResetableTextField(15));
    form.addResetableItem("No of doors : ", new ResetableCombo(doorItems));
    getContentPane().add(form);

When classes are resume, all students are required to finish their major projects for the last semester which includes composing custom essay.