If you added a few things to WizardPanel, it would help decouple each panel from the other panels. As it is now, if you have panels A, B, and C, you have to import B in A, and C in B to set the next panel. With these changes to WizardPanel, the linkages could be done centrally like this (which makes it easier to reorder, in my mind at least):
APanel aPanel = new APanel();
BPanel bPanel = new BPanel();
CPanel cPanel = new CPanel();
aPanel.setNextPanel(bPanel);
bPanel.setNextPanel(cPanel);
wizard.start(aPanel);
*** Suggested additions to WizardPanel:
private WizardPanel nextPanel;
public WizardPanel getNextPanel() {
return nextPanel;
}
public void setNextPanel(WizardPanel nextPanel) {
this.nextPanel = nextPanel;
}
public boolean hasNext() {
return getNextPanel() != null;
}
public WizardPanel next() {
return getNextPanel();
}