Remove File Protection Using java

In this video i'm going teach you how to remove file protection using java.
i use java io package for this lesson .
you can download netbeans project from here
http://ity.im/0rN90

 you can download flv video from here
http://ity.im/0rN91

code:   private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                       
              try {
            File file=new File(jTextField1.getText());
            file.setWritable(true);
            if (file.canWrite()) {
                jLabel2.setText("This File Is Writeble");
                jTextField1.setText(null);

            }
           else{
 jLabel2.setText("This File Is read Onley");
 }
        } catch (Exception e) {
        }    }       
 

How to make file Write Protected

In this lesson,i hope to teach you how to make file write protected using java.in this lesson i use Java IO package.
first i get input using j text field and
pass it value to j button
you can download net beans project
from here
http://ity.im/0rN93

you can download youtube video from here
http://ity.im/0rN94
Code :private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        try {
            File file=new File(jTextField1.getText());
            file.setReadOnly();
            if (file.canWrite()) {
                jLabel2.setText("This File Is Writeable");
            }
 else{
 jLabel2.setText("This File Is Read Onley");
 }        } catch (Exception e) {
        }    }