使用JComponentPack产品中的JWizardPane向导框架

Use JWizardPane in JComponentPack


JWizardPane is a Java wizard component in JComponentPack.

JWizardPane usage:

Sample code
JWizardPane wizardPane = new JWizardPane();
//wizardPane.setLogoIcon(logoIcon);
//wizardPane.setLogoText(logoText);
//wizardPane.getControlButton(JWizardPane.FINISH_CONTROL).setVisible(false);
//wizardPane.getControlButton(JWizardPane.HELP_CONTROL).setVisible(false);
JPanel firstPage = new JPanel(); // firstPage: the page you want to show first.
JPanel secondPage = new JPanel();
JPanel thirdPage = new JPanel();
JPanel endPage = new JPanel();
wizardPane.addPage(firstPage);
wizardPane.addPage(secondPage);
wizardPane.addPage(thirdPage);
wizardPane.addPage(endPage);
wizardPane .showFrame(“title”);

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.
@Override
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.
showFrame()
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 .


1394589.html?type=1

--------------------------
新闻: 调查:多数iPhone应用程序在下载后被弃用
导航: 博客园首页   知识库   新闻   招聘   社区   小组   博问   网摘   找找看

转载于:https://my.oschina.net/javastudy/blog/35

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值