Extreme Component Documentation

Use JWizardPane in JComponentPack

May 13, 2008

JWizardPane is a Java wizard component in JComponentPack.

JWizardPane usage:

Sample code
JWizardPane wizardPane = new JWizardPane();
JPanel firstPage = new JPanel(); // firstPage: the page you want to show first.
JPanel secondPage = new JPanel();
JPanel thirdPage = new JPanel();
JPanel endPage = new JPanel();

If you want to do some operations on one page, you could implement WizardPage interface, its methods will be called automatic when click the Next and Finish button.
The WizardPage interface have two methods:

beforeAction(JWizardPane wizardPane, WizardAction arg0)
afterAction(JWizardPane wizardPane, WizardAction arg0)
Here is an example to implement beforeAction method.
public void beforeAction(JWizardPane wizardPane, WizardAction arg0) throws ActionVetoException
    if (arg0 == WizardAction.NEXT || arg0 == WizardAction.FINISH) {
        //write the code you want to do.
Also you could implement other operations use WizardListener, for more information, please see WizardListener in the JComponentPack.

You could obtain the Button in the wizard panel use the method getControlButton(int buttonType), parameter must be the following value.

JWizardPane.BACK_CONTROL,  for back button
JWizardPane.NEXT_CONTROL,  for next button
JWizardPane.FINISH_CONTROL,  for finish button
JWizardPane.HELP_CONTROL,   for help button
JWizardPane.CANCEL_CONTROL,  for cancel button.

It have two way to show.one is showDialog,the other is showFrame.
showDialog(Component parent)
Pops up a dialog contains the JWizardPane and parented to parent with the dialog having a default title.
showDialog(Component parent, String title)
Pops up a dialog contains the JWizardPane and parented to parent with the dialog use the special title.
Pops up a frame contains the JWizardPane with the frame having a default title
showFrame(String title)
Pops up a frame contains the JWizardPane and with the frame use the special title.
If you want to pause the wizard page at current page, just throw a ActionVetoException is ok.
throw new ActionVetoException();
It also provide other functions, For more information, please see JWizardPane .

Subscribe RSS >>download

Send Us Feedback