01: /**
02: * Created on Dec 2, 2004
03: *
04: * @author karthikeyanr
05: *
06: */package example;
07:
08: import java.awt.event.ActionEvent;
09: import java.util.*;
10:
11: import javax.swing.*;
12:
13: import wizard.ui.AbstractWizard;
14:
15: public class Main extends JFrame {
16:
17: public static void main(String[] args) {
18: JFrame frame = new Main();
19: frame.setVisible(true);
20: }
21:
22: AbstractWizard wizard = new MyWizard(this , "Demo Wizard");
23:
24: public Main() {
25: super ("Main Frame");
26: buildWizard();
27: setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
28: getContentPane().add(new JButton(new ShowWizardAction()));
29: setLocationRelativeTo(null);
30: pack();
31: }
32:
33: private void buildWizard() {
34: List cardList = new Vector();
35: cardList.add(new DummyCard("First", true));
36: cardList.add(new SecondCard());
37: cardList.add(new DummyCard("Third"));
38: cardList.add(new DummyCard("Fourth"));
39: wizard.addCards(cardList);
40: }
41:
42: private class ShowWizardAction extends AbstractAction {
43: public ShowWizardAction() {
44: super ("Show Wizard");
45: }
46:
47: public void actionPerformed(ActionEvent e) {
48: wizard.setLocationRelativeTo(Main.this );
49: wizard.setVisible(true);
50: }
51: }
52: }
|