Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating Wizard Swing

Tags:

java

swing

wizard

I want to make a wizard using swing. I noticed that JOptionPane works just like a wizard, only the amount of input and the manner on which it is organized is limited.

Does anyone know how JOptionPane "waits" until the required input is given and the right button is pressed before returning the value at the end?

Does anyone know how to use JOptionPane so that the typical cardLayout of a wizard can be created?

like image 627
hasdrubal Avatar asked Feb 26 '26 23:02

hasdrubal


1 Answers

You can add arbitrary content to a JOptionPane, as shown here. That content can be a panel having CardLayout, as shown here. Given the JOptionPane.OK_CANCEL_OPTION, JOptionPane will wait until either button is clicked. If the result is JOptionPane.OK_OPTION, you can examine the cards' content as required.

like image 144
trashgod Avatar answered Mar 01 '26 13:03

trashgod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!