JTextArea problem
Hi, I have a problem whereby the JTextArea does not append the sentence "File not available" when the file by the name "myfile.pps" is not found in the "f " drive folder of the USB after i insert the USB diskdrive.
The JTextArea is required to append "File not available" when the system found there's no file "myfile.pps" in the USB folder of the user.
Can i know what's wrong with the code i did below?
publicvoid create(){
final JTextArea ta =new JTextArea(10,20);
ta.append("Searching USB disk drive\n\n");
final File f =new File("F://");
String filename ="f:\\myfile.pps";
if(f.exists()){
ta.append("Drive inserted!\n");
try{
Runtime.getRuntime().exec(new String[]{"cmd","/c","start","f:\\myfile.pps"});
}
catch (Exception x){
x.printStackTrace();
}
catch (Error r){
e.printStackTrace();
}
if(filename!="f:\\myfile.pps"){
ta.append("File not available!\n");
}
}
else{
ta.append("Detection failed!\n");
}
}
thanks alot,
jp

