public void jSaveButton_actionPerformed(ActionEvent actionEvent) {
    //    ii..
    FileFilter filter = new FileFilter( "Archivos Agente (*.agt)" );
    filter.add("agt");
    JFileChooser file = new JFileChooser( fileDir );
    file.setFileFilter(filter);
    if( file.showSaveDialog(this) == JFileChooser.APPROVE_OPTION ){
      try{
        fileDir = file.getSelectedFile().getAbsolutePath();
        fileName = file.getSelectedFile().getName();
        int pos = fileName.lastIndexOf(".agt");
        if( pos == -1 || pos != fileName.length()-4 ){
          fileDir += ".agt";
          fileName += ".agt";
        }
        FileWriter writer = new FileWriter(fileDir);
        writer.write(jTextArea1.getText());
        writer.close();
        this.setTitle(title + " [" + fileName + "]");
      }catch( Exception e ){
        e.printStackTrace();
      }
    }

  }