java问题:为什么该代码运行后没有出进度条,什么反应都没有…… 30
java问题:为什么该代码运行后没有出进度条,什么反应都没有……importjavax.swing.*;importjava.io.*;publicclassExampl...
java问题:为什么该代码运行后没有出进度条,什么反应都没有……import javax.swing.*;
import java.io.*;
public class Example10_18 {
public static void main(String[] args) {
// TODO Auto-generated method stub
byte b[]=new byte[30];
try{
FileInputStream input=new FileInputStream("Example10_18.java");
ProgressMonitorInputStream in=new ProgressMonitorInputStream(null,"读取java文件",input);
ProgressMonitor p=in.getProgressMonitor();
while(in.read(b)!=-1){
String s=new String(b);
System.out.print(s);
Thread.sleep(1000);
}
}
catch(Exception e){}
} 展开
import java.io.*;
public class Example10_18 {
public static void main(String[] args) {
// TODO Auto-generated method stub
byte b[]=new byte[30];
try{
FileInputStream input=new FileInputStream("Example10_18.java");
ProgressMonitorInputStream in=new ProgressMonitorInputStream(null,"读取java文件",input);
ProgressMonitor p=in.getProgressMonitor();
while(in.read(b)!=-1){
String s=new String(b);
System.out.print(s);
Thread.sleep(1000);
}
}
catch(Exception e){}
} 展开
展开全部
import java.io.FileInputStream;
import javax.swing.ProgressMonitor;
import javax.swing.ProgressMonitorInputStream;
public class Example10_18
{
public static void main ( String[] args )
{
try
{
FileInputStream input = new FileInputStream ("Example10_18.java");
ProgressMonitorInputStream in = new ProgressMonitorInputStream (null, "读取java文件", input);
byte b[] = new byte[1024];
while ( in.read (b) != -1)
{
String s = new String (b);
System.out.print (s);
Thread.sleep (60);
}
in.close ();
}
catch (Exception e)
{
e.printStackTrace ();
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |