JOptionPane
JOptionPane.showMessageDialog(null, "你好吗");
JOptionPane.showMessageDialog(null, "你好吗",null,JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(null, "你好吗", "标题",JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null, "你好吗", "标题",JOptionPane.PLAIN_MESSAGE);
intn = JOptionPane.showConfirmDialog(null, "你高兴吗?", "标题",JOptionPane.YES_NO_OPTION);//i=0/1
Object[] options ={ "好啊!", "去一边!" };
intm = JOptionPane.showOptionDialog(null, "我可以约你吗?", "标题",JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
yes 返回 0,no返回 1;
Object[] obj2 ={ "足球", "篮球", "乒乓球" };
String s = (String) JOptionPane.showInputDialog(null,"请选择你的爱好:\n", "爱好", JOptionPane.PLAIN_MESSAGE,null , obj2, null);
String a = (String)JOptionPane.showInputDialog(null,"请输入你的爱好:\n","title",JOptionPane.PLAIN_MESSAGE,null,null,"请在这里输入");
可以加一句打输出你输入的内容;