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) {
        }    }                            
         
 
 

How To Zip File Using Java

hi frends im sameera here .to day im going to teach you how to zip file using java.you can modify code as you wish .


 
download Video
http://ity.im/0rN96

download netbeans project
http://ity.im/0rN97

watch on youtube
http://ity.im/0rN98


thanks for comming :)
take care !
bye !

hmm here is the code
* zipit.java
 *
 * Created on Aug 20, 2011, 4:49:48 PM
 */
package howtozip;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.swing.JOptionPane;
/**
 *
 * @author Sameera
 */
public class zipit extends javax.swing.JFrame {
    /** Creates new form zipit */
    public zipit() {
        initComponents();
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jLabel1.setText("input path");
       jLabel2.setText("output path");
        jTextField1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jTextField2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jButton1.setText("ZIP IT");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(54, 54, 54)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTextField2)
                    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE))
                .addContainerGap(43, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(175, Short.MAX_VALUE)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(56, 56, 56))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(54, 54, 54)
                addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31))
        );
        pack();
    }// </editor-fold>                        
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        try {
            byte []buffer=new byte[1024];
            FileOutputStream fos=new FileOutputStream(jTextField2.getText());
            ZipOutputStream zos=new ZipOutputStream(fos);
            ZipEntry ze=new ZipEntry(jTextField1.getText());
            zos.putNextEntry(ze);
            FileInputStream in=new FileInputStream(jTextField1.getText());
            int len;
            while ((len=in.read(buffer))>0) {
                zos.write(buffer,0,len);
            }
            in.close();
            zos.closeEntry();
            zos.close();
            JOptionPane.showMessageDialog(null,"file was zipped");
            jTextField1.setText("");
            jTextField2.setText("");
        } catch (Exception e) {
        }
    }                                        
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new zipit().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    // End of variables declaration                   
}

 
 

Write Data To File

this video shows how to write data to a file.using java io package.hmmm
have fun.
see you in next tutorial.
thanks for comming!
take care !
bye ! 
Download video
http://www.mediafire.com/?whhnaoe4xikrmmbweeblylink_new_window


download Netbeans project
http://www.mediafire.com/?uwxynnjvt1a4aciweeblylink_new_window
watch on youtube
http://www.youtube.com/watch?v=HBWWu0-SJUoweeblylink_new_window
 
 

Create File using java

This lesson we are going to make file using java IO package .IO mean input out put .watch and have fun.and also you can download netbeans project that i have done :

Download Video
http://www.mediafire.com/?iq4y3259v9ddx1eweeblylink_new_window

Download Netbeans Project

http://www.mediafire.com/?6b9fbbb3k7n5h18weeblylink_new_window

watch On youtube
http://www.youtube.com/watch?v=9wG4HNY35Loweeblylink_new_window
 
 

Find Disk Space Using Java

This lesson shows how to calculate Disk Total size and free space and useable space using java. watch and have fun :)
thanks for comming 
bye take care !
you can download netbeans project that i have created .
1.Download Video
http://www.mediafire.com/?gabyo6kptzedv6bweeblylink_new_window


2.watch on youtube
http://www.youtube.com/watch?v=RJHqpqtDGO4weeblylink_new_window

3.Download Netbeans Project
http://www.mediafire.com/?294920vp82v2wfhweeblylink_new_window


 
 

Play mp3 Using   Jlayer

Picture
Hello Friends im sameera here.today im going to teach about how to play mp3 using java.it is pretty easy.you dont wonna worry,i teach every step :) ok
before we start our lesson we need to find some mp3 and download jlayer
you can just google as jlayer download
or i ll give download link hmm,i ll give the download link below.its easy nothing to serf :D
our porpose is when we paly main class it linked with another java form,we put jlable to jframe and it shows some word like "Mp3 is playing".it is additional step if u dont like it so don't do it :)
i use Do while loop for this becorse,if their isnt a loop the mp3 is play only one time,but we apply loop so it works till the condition goes  false.
here is the way to write do while loop.dont worry i teach some lessons about loops :)
this is for additional knowledge
do{ statement to do you wanna do     }
while
( condition true);

and also i use try catch in here because it prevent the exceptions and handle it.
i apply do while loop and try catch as this
 int i=0;
      do{
          try {
              FileInputStream file=new FileInputStream("C:\\Documents and Settings\\Sameera\\Desktop\\bl.mp3");
              Player playmp3=new Player(file);
              playmp3.play();
          } catch (Exception e) {
          }     
 }while(i<10);and full code in main class is like this:
package java2zmp3;
import java.io.FileInputStream;
import javazoom.jl.player.Player;
public class Main {   
     public static void main(String[] args) {    
  new Welcome().setVisible(true);  
    int i=0;    
  do{   
       try {       
       FileInputStream file=new FileInputStream("C:\\Documents and Settings\\Sameera\\Desktop\\bl.mp3");     
         Player playmp3=new Player(file);          
    playmp3.play();        
  } 
catch (Exception e) {          }  
    }
while(i<10);   
 }
}
watch the video and have fun don't forget to say thank thanks.

Download jlayer
http://ity.im/0rN9d


watch on youtube

http://www.youtube.com/watch?v=655reawVe9Mweeblylink_new_window

 download this video

http://ity.im/0rN9e
Download Netbens Project
http://www.mediafire.com/?w9hxs6aeepa7fs7weeblylink_new_window
Hint :
i genarate some codings by typing few letters and press ctrl+space :)