0

I want to place a "Next" button which , when clicked , will display another group of components ; and I want also to place a "Previous" button which , when clicked , then display the previous group of components. How to achieve that ?

pheromix
  • 18,213
  • 29
  • 88
  • 158

1 Answers1

0

I recently implemented forms for data entry. Typically i have a wizard class that holds all the forms in the wizard, so i can easily navigate back and forth between them. And when i call a new form, i pass along the object of the wizard.

Below is my wizard, with implementation omitted.

public final class ReportWizard {

    public static ReportWizard instance = null;
    Form parent = null;
    Form titleForm = null;
    Form budgetForm = null;
    Form iconForm = null;

    final Report reports[] = new Report[20];

    public ReportWizard(Form parent) {
        this.parent = parent;
        this.instance = this;
    }

    void getTitle() {
        AddReportForm reportForm = new AddReportForm(parent, this);
        reportForm.showReportForm();
        titleForm = reportForm;
        ImageListPicker getIcon = new ImageListPicker(titleForm, reports, this);
        iconForm = getIcon.imageListForm;
    }

    void getIcon() {
        iconForm.show();        
    }

    public void cancelWizard() {

        titleForm = null;
        iconForm = null;
        budgetForm = null;
        instance = null;

        parent.show();
        parent = null;
        System.gc();
    }
}
Ajibola
  • 1,218
  • 16
  • 28
  • how to go to next "screen" ? In fact the number of screens is the number of records from recorstore. – pheromix Jan 14 '13 at 05:48
  • 1
    Could you give some more details about the solution you want? I would not suggest you create too many Forms. Probably you can just do a removeAll() on the current form and reload the screen with new components. This will be a better solution than having many forms. – Ajibola Jan 14 '13 at 11:59