在考生文件夹中存有文件名为 Java_3.java 的文件,该程序是不完整的,请在注释行 ”//**********Found**********” 下一行语句的下划线地方填入正确的内容,然后删除下划线,请勿删除注释行或改动其他已有语句内容。存盘时文件必须存放在考生文件夹下,不得改变原有文件的文件名。本题的要求是:在考生文件夹中存有文件名为 Java_3.java 文件,该程序完成以下功能: 1.点击上图中的 ”JDialog” 按钮,弹出下图所示的对话框 2. 输入名字、口令后,在上图文本框中显示下图所输入的数据。 import javax.swing.*; import java.awt.*; import java.awt.event.*; //*********Found********** public class Java_3 extends __________________ implements ActionListener { private JFrame frame; private JTextField name; private JPasswordField pass; private JLabel nameLabel; private JLabel passLabel; private JPanel textPanel; private JPanel labelPanel; private JButton button; private JTextArea textArea; public void initGUI() { frame=new JFrame("Frame with Dialog"); //*********Found********** frame.________________(this); button=new JButton("JDialog"); //*********Found********** button._______________(this); textArea=new JTextArea("",3,10); frame.getContentPane().add(textArea,BorderLayout.CENTER); frame.getContentPane().add(button,BorderLayout.NORTH); frame.setSize(400,300); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { final JDialog dia=new JDialog(frame,"login information"); JButton ok=new JButton("ok"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textArea.setText(""); textArea.append("name:"+name.getText()+""); textArea.append("passWord:"+new String(pass.getPassword())+""); //*********Found********** dia.setVisible(________________); //隐藏对话框 } }); name=new JTextField("",10); pass=new JPasswordField("",10); pass.setEchoChar('*'); textPanel=new JPanel(); textPanel.setLayout(new GridLayout(2,1,10,10)); textPanel.add(name); textPanel.add(pass); nameLabel=new JLabel("name"); passLabel=new JLabel("passWord"); labelPanel=new JPanel(); labelPanel.setLayout(new GridLayout(2,1,20,20)); labelPanel.add(nameLabel); labelPanel.add(passLabel); dia.getContentPane().add(labelPanel,BorderLayout.WEST); dia.getContentPane().add(textPanel,BorderLayout.CENTER); dia.getContentPane().add(ok,BorderLayout.SOUTH); dia.setSize(200,130); dia.setVisible(true); } public void windowClosing(WindowEvent event) { frame.setVisible(false); System.exit(0); } public static void main(String args[]) { Java_3 example=new Java_3(); //*********Found********** example.____________; } }