public AbstractWizard(String title) {
jd = new JDialog();
jd.setTitle(title);
this.title = title;
final CardLayout cardLayout = new CardLayout();
cards = new JPanel(cardLayout);
btnBack = new JButton("< Back");
btnNext = new JButton("Next >");
btnFinish = new JButton("Finish");
setEnableButtons();
btnBack.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cardLayout.show(cards, Integer.toString(--currentStep));
setEnableButtons();
pages.get(currentStep).display();
}});
btnNext.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
AbstractWizardPage page = pages.get(currentStep);
String error = page.isPageComplete();
if(error == null) {
cardLayout.show(cards, Integer.toString(++currentStep));
setEnableButtons();
pages.get(currentStep).display();
} else {
JOptionPane.showMessageDialog(jd,
error,