java点击按钮事件,弹出窗口出错 求帮助啊0.0

部分代码如下:

//触发事件
class rfListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new ReceiveFile().start();
}
}
//窗口
public class ReceiveFile extends JFrame implements ActionListener{
private static final long serialVersionUID = 1L;
private JButton save = new JButton("保存文件");
private DatagramPacket dp;
private DatagramSocket ds;
private FileOutputStream fos;
private FileInputStream fis;
private String filename;
private byte[] buf = new byte[10240];

public ReceiveFile(){

     this.setSize(300,200);
     this.setLocation(500, 300);
     this.setTitle("接收文件");
     this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     this.setLayout(new FlowLayout());
     this.add(save);
     save.addActionListener(this);
     this.setVisible(true);

}

public void start(){
    try {
        ds = new DatagramSocket(4567);
        fos = new FileOutputStream("d:\\tem.dat");
            while(true){
                    dp = new DatagramPacket(buf, buf.length);
                    ds.receive(dp);
                    fos.write(dp.getData());
                    fos.flush();
            }
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
    }
}

弹出窗口后应该是这样的:图片说明
但是结果是这样的:图片说明

你这样写
//触发事件
class rfListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new Thread(new Runnable(){
public void run(){new ReceiveFile().start();}
}).start();
}
}

save.setVisible(true);

我这运行你的代码,能够显示。

是不是放到选项卡里点击就不行了???