Q:

Using Java how to disable the back button in a JFace wizard ?

0

Using Java how to disable the back button in a JFace wizard ?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

explained:

Disabling the back button is harder than it should be, due to non-intuitive behavior in the default implementation of WizardPage.getPreviousPage(). You can call setPreviousPage( null ), and getPreviousPage() still returns the previous page. You need to override the implementation of getPreviousPage() in order to disable the back button

public abstract class MyWizardPage extends WizardPage {
    private boolean backButtonEnabled = true;
    public void setBackButtonEnabled(boolean enabled) {
        backButtonEnabled = enabled;
        getContainer().updateButtons();
    }
    @Override
    public IWizardPage getPreviousPage() {
        if (!backButtonEnabled) {
            return null;
        }
        return super.getPreviousPage();
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now