public void actionPerformed(ActionEvent e) {
            if (e.getSource() == saveFile) {
                int choice = fileChooser.showSaveDialog(PrintWindow.this);
                if (choice == JFileChooser.APPROVE_OPTION) {
                    File file = fileChooser.getSelectedFile();
                    String filename = file.getPath() + ".txt";
                    BufferedWriter bfWrite = null;
                    try {
                        bfWrite = new BufferedWriter(new FileWriter(filename));
                        bfWrite.write(textArea.getText());
                    } catch (IOException x) {
                    } finally {
                        try {
                            if (bfWrite != null) {
                                bfWrite.close();
                            }
                        } catch (IOException x) {
                        }
                    }
                }
            }
            if (e.getSource() == printFile) {
                try {
                    textArea.print();
                } catch (PrinterException x) {
                    // Print job did not complete.
                }
            }
        }