如何实现向导屏幕之类的东西?

时间:2013-01-11 13:30:34

标签: lwuit lwuit-form

我想放置一个“下一步”按钮,当点击它时,会显示另一组组件;我还要放置一个“上一个”按钮,单击该按钮,然后显示上一组组件。如何实现?

1 个答案:

答案 0 :(得分: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();
    }
}