Java 如何在单独的JOptionPane中显示不同的数组

Java 如何在单独的JOptionPane中显示不同的数组,java,joptionpane,Java,Joptionpane,我正在尝试制作3JOptionPane。每一个都必须显示一些数据数组 第一个必须显示firstDataArray的20个信息 只有当用户单击“取消”时,我才希望弹出新的作业窗格,它必须显示secondDataArray等的信息 我面临的问题是,当用户在第一个JOptionPane上单击取消时,第二个JOptionPane将显示第一个DataArray和第二个DataArray的所有信息(我想要两个分开的JOptionPane,使用不同的数组列表) 当第二个作业窗格的取消底部时,第三个作业窗格显示

我正在尝试制作3
JOptionPane
。每一个都必须显示一些数据数组

第一个必须显示firstDataArray的20个信息

只有当用户单击“取消”时,我才希望弹出新的
作业窗格
,它必须显示secondDataArray等的信息

我面临的问题是,当用户在第一个
JOptionPane
上单击取消时,第二个
JOptionPane
将显示第一个DataArray和第二个DataArray的所有信息(我想要两个分开的
JOptionPane
,使用不同的数组列表)

当第二个
作业窗格
的取消底部时,第三个
作业窗格
显示3数据数组的所有信息时,情况相同

我做错了什么

非常感谢

鲈鱼


您总是将每个数组附加到相同的
StringBuilder

为每个
JOptionPane

        StringBuilder textRegion = new StringBuilder();

        String txt = JOptionPane.showInputDialog(null,
                textRegion.append(Arrays.toString(firstDataArray).replace("[", "").replace("]", "").replace(",", "")).append('\n'), "Choose Option)",
                JOptionPane.PLAIN_MESSAGE);
        //If the user click cancel , show the other array in a new JoptionPane   
        if (txt == null) {
            textRegion = new StringBuilder(); // <--- 
            txt = JOptionPane.showInputDialog(null,
                    textRegion.append(Arrays.toString(secondDataArray).replace("[", "").replace("]", "").replace(",", "")).append('\n'), "Choisir municipalite (Chose option)",
                    JOptionPane.PLAIN_MESSAGE);


                //If the user click cancel again , show the other array in a third JoptionPane  
                if (txt == null) {
                textRegion = new StringBuilder(); // <---

                txt = JOptionPane.showInputDialog(null,
                        textRegion.append(Arrays.toString(thirdDataArray).replace("[", "").replace("]", "").replace(",", "")).append('\n'), "Chose Option)",
                        JOptionPane.PLAIN_MESSAGE);
                if (txt == null) {

                } else {
                    setNomMunicipalite(txt);
                }

            } else {
                setNomMunicipalite(txt);
            }
        } else {
            setNomMunicipalite(txt);
        }
StringBuilder textRegion=new StringBuilder();
String txt=JOptionPane.showInputDialog(null,
textRegion.append(Arrays.toString(firstDataArray).replace(“[”,”).replace(“],”).replace(“,”,”).append(“\n”),“Choose Option)”,
JOptionPane.普通消息);
//如果用户单击“取消”,则在新作业窗格中显示其他阵列
如果(txt==null){

textRegion=new StringBuilder();//您总是将每个数组附加到相同的
StringBuilder

为每个
JOptionPane

        StringBuilder textRegion = new StringBuilder();

        String txt = JOptionPane.showInputDialog(null,
                textRegion.append(Arrays.toString(firstDataArray).replace("[", "").replace("]", "").replace(",", "")).append('\n'), "Choose Option)",
                JOptionPane.PLAIN_MESSAGE);
        //If the user click cancel , show the other array in a new JoptionPane   
        if (txt == null) {
            textRegion = new StringBuilder(); // <--- 
            txt = JOptionPane.showInputDialog(null,
                    textRegion.append(Arrays.toString(secondDataArray).replace("[", "").replace("]", "").replace(",", "")).append('\n'), "Choisir municipalite (Chose option)",
                    JOptionPane.PLAIN_MESSAGE);


                //If the user click cancel again , show the other array in a third JoptionPane  
                if (txt == null) {
                textRegion = new StringBuilder(); // <---

                txt = JOptionPane.showInputDialog(null,
                        textRegion.append(Arrays.toString(thirdDataArray).replace("[", "").replace("]", "").replace(",", "")).append('\n'), "Chose Option)",
                        JOptionPane.PLAIN_MESSAGE);
                if (txt == null) {

                } else {
                    setNomMunicipalite(txt);
                }

            } else {
                setNomMunicipalite(txt);
            }
        } else {
            setNomMunicipalite(txt);
        }
StringBuilder textRegion=new StringBuilder();
String txt=JOptionPane.showInputDialog(null,
textRegion.append(Arrays.toString(firstDataArray).replace(“[”,”).replace(“],”).replace(“,”,”).append(“\n”),“Choose Option)”,
JOptionPane.普通消息);
//如果用户单击“取消”,则在新作业窗格中显示其他阵列
如果(txt==null){

textRegion=new StringBuilder();/@napi15很乐意帮忙。:-@napi15很乐意帮忙。:-)