AbstractWizard

Hi,

I'm trying to make a wizard. I am able to show the wizard but it is juat a small empty frame. I have searched but can't find any information about how to do this.

This is what I got so far:

public static AbstractWizard create(Project project) {
    AbstractWizard wizard = new AbstractWizard(project.getName(),project){

        @Override
        protected String getHelpID() {
            return "MyWizard";
        }
    };

    wizard.addStep(new FirstStep());
    wizard.centerRelativeToParent();
    wizard.setSize(500, 500);

    return wizard;
}

And the FirstStep class:

public class FirstStep extends AbstractWizardStepEx {

    private JButton field = new JButton();

    public FirstStep() {
        super("First Step");
        field.setText("Dummy");
        field.setBounds(0, 0, 200, 200);
        field.show();
    }

    @NotNull
    @Override
    public Object getStepId() {
        return "getStepId";
    }

    @Nullable
    @Override
    public Object getNextStepId() {
        return "getStepId";
    }

    @Nullable
    @Override
    public Object getPreviousStepId() {
        return "getStepId";
    }

    @Override
    public boolean isComplete() {
        return false;
    }

    @Override
    public void commit(CommitType commitType) throws CommitStepException {

    }

    @Override
    public JComponent getComponent() {
        return field;
    }

    @Nullable
    @Override
    public JComponent getPreferredFocusedComponent() {
        return field;
    }
}

0

I actually think I figured this one out, I need to extend the AbstractWizard and call init(); in the constructor. Now I acually have a dialog, looking kinda weird but that I can work on. But any additional information of tips are welcom. Tnx.

0

请先登录再写评论。