Saturday, December 1, 2012

  These days i'm creating a  notepad in Netbeans but i Got a problem my Save button does not work can anyone help me on this this is my chording





  private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        FileFilter ft = new FileNameExtensionFilter("Text Files","txt");
         FileFilter ft1 = new FileNameExtensionFilter("HTML Files","html");
        db.addChoosableFileFilter(ft);
        db.addChoosableFileFilter(ft1);
        int returnVal = db.showSaveDialog(this);
       
        if(returnVal == javax.swing.JFileChooser.APPROVE_OPTION){
           
            java.io.File save_file = db.getSelectedFile();
            String File_name =  save_file.toString();
           
            try{
               
                write data = new write(File_name, true);
                String alltext = jTextArea1.getText();
                data.writeToFile(alltext);
               
            }
            catch(IOException e ){
               
               
            }
           
           
          
        }
       

       
       
       

No comments:

Post a Comment