aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Wizards and CardLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Wizards and CardLayout" Watch "Wizards and CardLayout" New topic
Author

Wizards and CardLayout

Mark Fletcher
Ranch Hand

Joined: Dec 08, 2001
Posts: 897
Hi,
Im playing about with awt and Swing and Id like to create a wizard like dialog. I figured the easiest way at first glance was to use a cardlayout for the main part of the dialog.
The problem Im having is that using the previous() and next() methods of CardLayout, I cant prevent my Next and Previous buttons from looping round to the first card again. Is there anyway I can test for the next card?
Any help greatly appreciated!
Cheers,
Mark
My code listing is below


Mark Fletcher - http://www.markfletcher.org/blog
I had some Java certs, but they're too old now...
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Mark,
Yes I think you can do that. The following code should work.

It probably would be a nicer approach to have the buttons become disabled when they shouldn't be clicked. The method below can be used for that.

The new routine would need to be called immediately before the show method and after changing the displayed card. For example, using the lower part of your code:

Regards,
Manfred.
Mark Fletcher
Ranch Hand

Joined: Dec 08, 2001
Posts: 897
Hi Manfred,
Thanks for your reply!
Cheers
Mark
Brian Coates
Ranch Hand

Joined: Jul 03, 2001
Posts: 42
I implemented a wizard using this same method for enabeling/disabeling the Next & Back buttons. It works fine on my Win machine (using JDK 1.2.2_006 and 1.3.0-C), however it doesn't on a Unix box running JDK 1.3.0. The "cancel" button is enabled, but none of the others are.
My code looks like the above snipped.
Any ideas..?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wizards and CardLayout