java编一个程序:首先是可以输入内容的对话框,按确定按钮后弹出一个新的对话框,并显示你所输入的内容。

如题所述

import javax.swing.JOptionPane;

public class ShowText {
public static void main(String[] args) {
String str = (String) JOptionPane.showInputDialog(null, "请输入你大名:\n", "输入ID", JOptionPane.PLAIN_MESSAGE, null, null,
"请输入ID");
JOptionPane.showMessageDialog(null, str, "显示ID",JOptionPane.PLAIN_MESSAGE);  
}
}

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答