0
我希望用户在对话框中输入各种字符串和整数,但我想显示在一个对话框中的所有信息的最终输出。这是我的:我想在单个对话框中显示多个输出。我该如何做到这一点?
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);
顺便说一句,我看不到片断如何能够编译,更不用说运行。 – 2011-03-13 06:47:12