Desain seperti gambar
Masukkan file txt di C:\\ .
Coding pada tombol BACA :
String aLine;
try{
URL source= new URL("file",null,"C:\\coba applet.txt");
BufferedReader br =new BufferedReader (new InputStreamReader(source.openStream()));
aLine=br.readLine();
BufferedReader br =new BufferedReader (new InputStreamReader(source.openStream()));
aLine=br.readLine();
jTextArea3.setText(aLine);
while(null != (aLine = br.readLine())){
while(null != (aLine = br.readLine())){
jTextArea3.setText(jTextArea3.getText()+"\n"+aLine);
}
br.close();
jLabel6.setText("File berada di : C:\\");
jLabel6.setText("File berada di : C:\\");
} catch(Exception e) {
e.printStackTrace();
}
e.printStackTrace();
}
04.30 |
Category:
Applet
|
0
komentar
Comments (0)