private void FileChooserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FileChooserActionPerformed
        myFile = FileChooser.getSelectedFile();
        this.setVisible(false);
        try
        {
            String tmp = "";
            String line= "";
            BufferedReader reader;
            BufferedWriter writer;
        
            switch (mode)
            {
                case 1:
                    reader = new BufferedReader(new FileReader(myFile.getAbsolutePath()));
                    while((line=reader.readLine())!=null)
                    {
                        tmp += line+"\n";
                    }
                    myFrame.setHTML(tmp);
                    reader.close();
                    break;
                case 2:
                    reader = new BufferedReader(new FileReader(myFile.getAbsolutePath()));
                    while((line=reader.readLine())!=null)
                    {
                        tmp += line+"\n";
                    }
                    myFrame.setBBCode(tmp);
                    reader.close();
                    break;
                case 3:
                    writer= new BufferedWriter(new FileWriter(myFile.getAbsolutePath()));
                    writer.write(myFrame.getHTML());;
                    writer.close();
                    break;
                case 4:
                    writer= new BufferedWriter(new FileWriter(myFile.getAbsolutePath()));
                    writer.write(myFrame.getBBCode());
                    writer.close();
                    break;
            }
        }
        catch (IOException e) {javax.swing.JOptionPane.showMessageDialog(null, "Cannot read file", "Error", javax.swing.JOptionPane.ERROR_MESSAGE);}
    }