方法调用的问题 我加上stream.close()后我的程序不能停下来,一直在运行,这是为什么,上面的问题我好像知道了,不过还请高手指教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.awt.*;import java.awt.event.*;import java.io.*;import java.net.*;public class FileLister extends Frame {TextArea text;public FileLister(){addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){ dispose();}});text=new TextArea(" ",24,80);text.setFont(new Font("MonoSpaced",Font.PLAIN,12));text.setEditable(false);this.add("Center",text);Panel p=new Panel();p.setLayout(new FlowLayout(FlowLayout.RIGHT,10,5));this.add(p,"South");this.pack();}public void getUrl(){try{URL url=new URL("http://www.sina.com.cn/");String in;DataInputStream stream=new DataInputStream(url.openStream());while((in=stream.readLine())!=null){text.append(in);text.setCaretPosition(0);}}catch(MalformedURLException e){System.out.println("MalformedURLException:"+e);}catch(IOException e){System.out.println("IOException:"+e);}}public static void main(String [] args){FileLister f=new FileLister();f.addWindowListener(new WindowAdapter(){public void windowClosed(WindowEvent e){ System.exit(0);}});f.show();f.getUrl();}}此程序没问题给分吧 import java.awt.*;import java.awt.event.*;import java.io.*;import java.net.*;public class FileLister extends Frame {TextArea text;public FileLister(){addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){ dispose();}});text=new TextArea(" ",24,80);text.setFont(new Font("MonoSpaced",Font.PLAIN,12));text.setEditable(false);this.add("Center",text);Panel p=new Panel();p.setLayout(new FlowLayout(FlowLayout.RIGHT,10,5));this.add(p,"South");this.pack();}public void getUrl(){try{URL url=new URL("http://www.sina.com.cn/");String in;DataInputStream stream=new DataInputStream(url.openStream());while((in=stream.readLine())!=null){text.append(in);text.setCaretPosition(0);}}catch(MalformedURLException e){System.out.println("MalformedURLException:"+e);}catch(IOException e){System.out.println("IOException:"+e);}}public static void main(String [] args){FileLister f=new FileLister();f.addWindowListener(new WindowAdapter(){public void windowClosed(WindowEvent e){ System.exit(0);}});f.show();f.getUrl();}}此程序没问题给分吧 import java.awt.*;import java.awt.event.*;import java.io.*;import java.net.*;public class FileLister extends Frame {TextArea text;public FileLister(){addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){ dispose();}});text=new TextArea(" ",24,80);text.setFont(new Font("MonoSpaced",Font.PLAIN,12));text.setEditable(false);this.add("Center",text);Panel p=new Panel();p.setLayout(new FlowLayout(FlowLayout.RIGHT,10,5));this.add(p,"South");this.pack();}public void getUrl(){try{URL url=new URL("http://www.sina.com.cn/");String in;DataInputStream stream=new DataInputStream(url.openStream());while((in=stream.readLine())!=null){text.append(in);text.setCaretPosition(0);}}catch(MalformedURLException e){System.out.println("MalformedURLException:"+e);}catch(IOException e){System.out.println("IOException:"+e);}}public static void main(String [] args){FileLister f=new FileLister();f.addWindowListener(new WindowAdapter(){public void windowClosed(WindowEvent e){ System.exit(0);}});f.show();f.getUrl();}}此程序没问题给分吧 大家帮我看看这个题目 swingweb 关于replaceAll的问题 关于数据库与java的问题 求书:《Java Rules 》第二版,(英文/电子版) 关于类之间访问的问题 求资料:如何实现实时传输MPEG4码流?(mpeg4解码器已经实现,但JFM的rtp不支持mpeg4格式) 事务问题。 高分请教关于网络编程方面的? Eclipse导入JAR包无法Import的问题 URL的问题!!!! java 中中文编码问题 是不是 与本地系统有关?
import java.awt.event.*;
import java.io.*;
import java.net.*;public class FileLister extends Frame {
TextArea text;
public FileLister(){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){ dispose();}
});text=new TextArea(" ",24,80);
text.setFont(new Font("MonoSpaced",Font.PLAIN,12));
text.setEditable(false);
this.add("Center",text);Panel p=new Panel();
p.setLayout(new FlowLayout(FlowLayout.RIGHT,10,5));
this.add(p,"South");this.pack();}public void getUrl(){
try{
URL url=new URL("http://www.sina.com.cn/");
String in;
DataInputStream stream=new DataInputStream(url.openStream());
while((in=stream.readLine())!=null){
text.append(in);
text.setCaretPosition(0);
}
}catch(MalformedURLException e){
System.out.println("MalformedURLException:"+e);
}catch(IOException e){
System.out.println("IOException:"+e);
}
}public static void main(String [] args){
FileLister f=new FileLister();
f.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){ System.exit(0);}
});f.show();
f.getUrl();
}}
此程序没问题给分吧
import java.awt.event.*;
import java.io.*;
import java.net.*;public class FileLister extends Frame {
TextArea text;
public FileLister(){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){ dispose();}
});text=new TextArea(" ",24,80);
text.setFont(new Font("MonoSpaced",Font.PLAIN,12));
text.setEditable(false);
this.add("Center",text);Panel p=new Panel();
p.setLayout(new FlowLayout(FlowLayout.RIGHT,10,5));
this.add(p,"South");this.pack();}public void getUrl(){
try{
URL url=new URL("http://www.sina.com.cn/");
String in;
DataInputStream stream=new DataInputStream(url.openStream());
while((in=stream.readLine())!=null){
text.append(in);
text.setCaretPosition(0);
}
}catch(MalformedURLException e){
System.out.println("MalformedURLException:"+e);
}catch(IOException e){
System.out.println("IOException:"+e);
}
}public static void main(String [] args){
FileLister f=new FileLister();
f.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){ System.exit(0);}
});f.show();
f.getUrl();
}}
此程序没问题给分吧
import java.awt.event.*;
import java.io.*;
import java.net.*;public class FileLister extends Frame {
TextArea text;
public FileLister(){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){ dispose();}
});text=new TextArea(" ",24,80);
text.setFont(new Font("MonoSpaced",Font.PLAIN,12));
text.setEditable(false);
this.add("Center",text);Panel p=new Panel();
p.setLayout(new FlowLayout(FlowLayout.RIGHT,10,5));
this.add(p,"South");this.pack();}public void getUrl(){
try{
URL url=new URL("http://www.sina.com.cn/");
String in;
DataInputStream stream=new DataInputStream(url.openStream());
while((in=stream.readLine())!=null){
text.append(in);
text.setCaretPosition(0);
}
}catch(MalformedURLException e){
System.out.println("MalformedURLException:"+e);
}catch(IOException e){
System.out.println("IOException:"+e);
}
}public static void main(String [] args){
FileLister f=new FileLister();
f.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e){ System.exit(0);}
});f.show();
f.getUrl();
}}
此程序没问题给分吧