private void saveFileAs(){
        JFileChooser fileChooser = new JFileChooser();
        FileNameExtensionFilter filter = new FileNameExtensionFilter("TeX files/.tex", ".tex");
        fileChooser.setFileFilter(filter);
        String content = new LaTeXDocument().getDocumentContents();
        byte buffer[] = content.getBytes();
        if (fileChooser.showSaveDialog(window) == JFileChooser.APPROVE_OPTION){
            try{
                File file = fileChooser.getSelectedFile();
                OutputStream out = new FileOutputStream(file+".tex");
                out.write(buffer);
                out.close();
            }catch (IOException exception){
                    JOptionPane.showMessageDialog(null,exception);
            }
        }
    }