Java 我想在一个对话框中显示多个输出。我如何做到这一点?
我希望用户在对话框中输入各种字符串和整数,但我希望最终输出的所有信息都显示在一个对话框中。这就是我所拥有的:Java 我想在一个对话框中显示多个输出。我如何做到这一点?,java,swing,dialog,jdialog,Java,Swing,Dialog,Jdialog,我希望用户在对话框中输入各种字符串和整数,但我希望最终输出的所有信息都显示在一个对话框中。这就是我所拥有的: JOptionPane.showMessageDialog("Product Name" + inv[i].getName(), JOptionPane.PLAIN_MESSAGE); JOptionPane.showMessageDialog("Product Type" + theItem.getType(), JOptionPan
JOptionPane.showMessageDialog("Product Name" + inv[i].getName(), JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog("Product Type" + theItem.getType(), JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog("Product Number", + theItem.getpNumber(), JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog("Amount of Units in Stock", + theItem.getUnits(), JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog("Price per Unit", + theItem.getPrice(), JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog("Total cost for %s in stock: $%.2f", theItem.getName(), theItem.calculateTotalPrice(), JOptionPane.PLAIN_MESSAGE);
有多种选择
您还可以通过扩展
JDialog
并对其进行适当定制来创建自己的对话框类。顺便说一句,我看不出该代码段是如何编译的,更不用说运行了。