相关疑难解决方法(0)

文件编写器不起作用

我使用FileWriter和BufferWriter写入文件.创建了文件"test.txt",但没有写入任何内容.

该文件应该写在我的按钮的ActionEvent中.那是什么原因?

那是我的代码:

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;  
import java.util.UUID;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

class Cadre_fenetreA2 extends JFrame            
{
    JLabel phrase = new JLabel("Veuillez indiquer le nom de chaque groupe de generalisation pour chaque Niveau");
    JButton boutonOK = new JButton ("OK");
    public Cadre_fenetreA2 (String nom,int X, int Y, int lo, int la, int Na, int [] nbGrpGen,int maxnbGrpGen, File file)        
    {
        super(nom);                     
        setBounds(X,Y,lo,la);       
        setVisible(true);                   


        JTextField[][] allField = …
Run Code Online (Sandbox Code Playgroud)

java file

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

file ×1

java ×1