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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With