• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wizards and CardLayout

 
Ranch Hand
Posts: 897
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 897
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Manfred,
Thanks for your reply!
Cheers
Mark
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..?
 
reply
    Bookmark Topic Watch Topic
  • New Topic