问题描述
我想使用swing制作一个向导。我注意到JOptionPane就像向导一样工作,只有输入的数量和组织的方式是有限的。
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.
在给出所需的输入并按下右键之前,有人知道JOptionPane如何等待吗?
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?
有没有人知道如何使用JOptionPane以便可以创建向导的典型cardLayout?
Does anyone know how to use JOptionPane so that the typical cardLayout of a wizard can be created?
推荐答案
您可以将任意内容添加到 JOptionPane
,如所示。给定 JOptionPane.OK_CANCEL_OPTION
, JOptionPane
将等待,直到单击任一按钮。如果结果是 JOptionPane.OK_OPTION
,您可以根据需要检查卡片的内容。
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.
这篇关于创建向导Swing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!