      import java.io.*;
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class ardisikDosyaYaratSWF_2000 extends JFrame implements ActionListener
      {
      private JTextField hesapIsmiKutusu,isimKutusu,soyIsimKutusu,hesapKutusu;
      private JButton enter,done;
      private DataOutputStream cikti;
      private JLabel H,I,S,P;
      Container c;

      public ardisikDosyaYaratSWF_2000()
      {
      super("Müşteri dosyasi Aç");
      c=getContentPane();
      try{
      cikti=new DataOutputStream(new FileOutputStream("musteri.txt"));
      } catch(IOException e)
      { System.err.println("Dosya doğru açılamadı\n"+e.toString());
      System.exit(1);
      }
      c.setLayout(new GridLayout(5,2));
      H=new JLabel("Hesap numarasi :");
      c.add(H);
      hesapIsmiKutusu=new JTextField();
      c.add(hesapIsmiKutusu);
      I=new JLabel("isim : ");
      c.add(I);
      isimKutusu=new JTextField(20);
      c.add(isimKutusu);
      S=new JLabel("Soyisim : ");
      c.add(S);
      soyIsimKutusu=new JTextField(20);
      c.add(soyIsimKutusu);
      P=new JLabel("Hesaptaki para : ");
      c.add(P);
      hesapKutusu=new JTextField(20);
      c.add(hesapKutusu);
      enter=new JButton("Gir");
      enter.addActionListener(this);
      c.add(enter);
      done=new JButton("Cikis");
      done.addActionListener(this);
      c.add(done);
      setVisible(true);
      }

      public void hesapEkle()
      {
      int accountNumber=0;
      Double d;
      if(!hesapIsmiKutusu.getText().equals(""))
      {
      try{
      accountNumber=Integer.parseInt(hesapIsmiKutusu.getText());
      if(accountNumber>0)
      {
      cikti.writeInt(accountNumber);
      cikti.writeUTF(isimKutusu.getText());
      cikti.writeUTF(soyIsimKutusu.getText());
      d=new Double(hesapKutusu.getText());
      cikti.writeDouble(d.doubleValue());
      }
      hesapIsmiKutusu.setText("");
      isimKutusu.setText("");
      soyIsimKutusu.setText("");
      hesapKutusu.setText("");
      }
      catch(NumberFormatException nfe)
      {
      System.err.println("Hesap numarasi tamsayi degisken olamalidir");
      }
      catch(IOException io)
      {
      System.err.println("Dosyaya yazarken hata olustu\n"+io.toString());
      System.exit(1);
      }
      }
      }
      
      public void actionPerformed(ActionEvent e)
      {
      hesapEkle();
      if(e.getSource()==done)
      {
      try{ cikti.close();}
      catch(IOException io)
      {
      System.err.println("Dosya kapatilamadi\n"+io.toString());
      }
      System.exit(0);
      }
      }

      public static void main(String[] args)
      {
      ardisikDosyaYaratSWF_2000 pencere= new ardisikDosyaYaratSWF_2000();
      pencere.setSize(300,150);
      pencere.addWindowListener(new BasicWindowMonitor());
      pencere.setVisible(true);
      }

}
