public void save()
{
    DataOutputStream fos;
          try {
              if (!bufferedStrokes.isEmpty())
              {
                  JOptionPane.showMessageDialog(rootPane, "Please wait for the file to buffer!");
                  return;
              }
              File lll = new File("maps");
              if (!lll.exists())
              {
                  lll.mkdir();
              }
              String name = JOptionPane.showInputDialog("Save as?");
              File file = new File(dir+"maps"+File.separator+name+".ter");
              
              fos = new DataOutputStream(new FileOutputStream(file));
              fos.writeInt(www);
              fos.writeInt(hhh);
              for (int i = 0; i < writeData.length; i++)
              {
                  fos.write(writeData[i]);
              }
              fos.flush();
              fos.close();
          } catch (HeadlessException | IOException ex) {
              Logger.getLogger(MapMaker.class.getName()).log(Level.SEVERE, null, ex);
          }
}