Java 无法将JTextArea内容打印到文件中

Java 无法将JTextArea内容打印到文件中,java,file,security,jtextarea,japplet,Java,File,Security,Jtextarea,Japplet,我有一个小程序,在按下提交按钮时,某些操作会发生。 我在文本区打印了我的stackTrace。 我想将TextArea的内容写入文件。但文件中没有显示任何内容。 我哪里做错了? 这是我的密码 public void actionPerformed(ActionEvent ae) { Firstname=t1.getText(); Lastname=t2.getText(); Birthdate=t3.getText();

我有一个小程序,在按下提交按钮时,某些操作会发生。 我在文本区打印了我的stackTrace。 我想将TextArea的内容写入文件。但文件中没有显示任何内容。 我哪里做错了? 这是我的密码

      public void actionPerformed(ActionEvent ae)
    {
       Firstname=t1.getText();
       Lastname=t2.getText();
       Birthdate=t3.getText();
       if(r1.isSelected())
       {Gender=r1.getText();
        }
        else
        Gender=r2.getText();
        State=t4.getText();
        City=t5.getText();
        Hobby=jl1.getSelectedItem();
        Education=jl2.getSelectedItem();
        Occupation=jl3.getSelectedItem();
        HobbyS=Hobby.toString();
       EducationS=Education.toString();
        OccupationS=Occupation.toString();

        JOptionPane.showMessageDialog( frame,"BEFORE FUNCTION CALL");
     callFunction();

    }

    public void callFunction()

        {
        JOptionPane.showMessageDialog( frame,"IN FUNCTION");
        String test;
        String test1;
        String test2;
        JOptionPane.showMessageDialog( frame," CREATE OBJECT NOW");
       EmbeddedNeo4j hello = new EmbeddedNeo4j();
   JOptionPane.showMessageDialog( frame,"OBJECT CREATED");
   test1=hello.verify(Firstname);

   test2=hello.start() ;       tExtra.setText(test2);       String str= tExtra.getText();            try {          FileWriter fr= new FileWriter("C:\\neo4j-community 1.9.6\\data\\graph.db\\connection\\st.txt");        BufferedWriter fileOut = new BufferedWriter(fr);        fileOut.write(str);         fileOut.close();       }        catch (IOException ioe) {    JOptionPane.showMessageDialog( frame,"NOT FOUND");    ioe.printStackTrace();           }         test=hello.createDb(Firstname,Lastname,Gender,State,City,HobbyS,EducationS,OccupationS);       JOptionPane.showMessageDialog( frame,test);        }What am i doing wrong?

我解决了这个问题。我知道只有签名的小程序才能进行文件I/O。可选方法是按照“可选方法是按照..中给出的方向复制文本区域中的内容”中给出的方向复制文本区域中的内容。否。沙盒小程序也不能使用剪贴板。有关详细信息,请参阅。您需要记住,这些限制是为了用户的利益而存在的。如果一个不受信任的小程序可以查询剪贴板,它可以跟踪用户复制和粘贴的所有内容。有时用户可能会复制/粘贴URL,然后是用户名和密码。砰!小程序可以访问他们的电子邮件(亚马逊登录、易趣登录、贝宝登录、银行登录)!