0

我想放置一个“下一步”按钮,单击该按钮将显示另一组组件;我还想放置一个“上一个”按钮,单击该按钮时,会显示上一组组件。如何做到这一点?

4

1 回答 1

0

我最近实施了数据输入表格。通常,我有一个向导类,其中包含向导中的所有表单,因此我可以轻松地在它们之间来回导航。当我调用一个新表单时,我会传递向导的对象。

下面是我的向导,省略了实现。

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();
    }
}
于 2013-01-13T22:35:22.493 回答