The SPAFObjectWizard wizard.

Component Java
Build Wizards Quickly Using a Swing-Based Wizard Framework
Chang Sau Sheong
Listing 8. The SPAFObjectWizard wizard.


package com.sttarfire.SPAFBuilder;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import com.sttarfire.wizard.*;

public class SPAFObjectWizardFrame1 extends WizardFrame {

   JTextField nameText;
   JTextField packageText;
   JTextField pkText;
   WizardTextBoxPanel tb;
  
   public void customize() {
      purgeFrames(); // (1)
      setFrameLabel1("SPAFObject Wizard",
  	            new Font("SansSerif", Font.BOLD, 16)); // (2)
      setFrameLabel2("Enter values for the SPAFObject and click Next"); // (2)

     Hashtable textBoxes = new Hashtable(); // (3)
     textBoxes.put("Class Name", new Integer(20));
     textBoxes.put("Package", new Integer(30));
     textBoxes.put("Primary key", new Integer(30));

     tb = new WizardTextBoxPanel(textBoxes); // (4)
     centerPane.setLayout(new BorderLayout()); // (5)
     centerPane.add(tb, BorderLayout.CENTER);		
  }

  public void nextAction() {
    super.nextAction();
    try {
	putData("classname", tb.getComponentData("Class Name"));
	putData("packagename", tb.getComponentData("Package"));
	putData("primarykey", tb.getComponentData("Primary key"));
    }
    catch (Exception e) {
    }
  }

About the Author

Chang Sau Sheong is vice president of product engineering at elipva Ltd. (formerly known as sstarfire.com). He can be contacted at [email protected].