<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.URL;
import java.net.*;
class win extends Frame implements ActionListener
{
TextArea text;
TextArea text2=new TextArea();;
String url;
Panel panel;
int ite=0;
TextField qihao;
TextArea text1=new TextArea();
Button button1;
BufferedWriter out;
String txt;
StringBuffer sb;
StringBuffer s2=new StringBuffer();
win()
{
super("test!");
setLayout(new BorderLayout());
setBackground(Color.cyan);
setBounds(150,150,300,120);
setVisible(true);
text=new TextArea();
button1=new Button("确定");
qihao=new TextField(16);
panel=new Panel();
panel.add(qihao);
panel.add(button1);
add("North",panel);
add(text,"Center");
button1.addActionListener(this);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
setVisible(false);
System.exit(0);
}
});
}public void actionPerformed(ActionEvent e) {
if(e.getSource()==button1)
{
System.out.println("beginning!");
int hao=new Integer(qihao.getText().trim()).intValue();
for(int j=1;j<=10;j ){
for(int i=1;i<=1000;i )
{
try{
Reder(hao);
}catch(Exception er){}
hao=hao 1;
txt=text1.getText();
try{
txt=getStrings(txt);
}catch(Exception er){}
text2.append(txt "/n");
text1.setText("");
System.out.println(i);
}
txt=text2.getText();
text2.setText("");
try{
out=new BufferedWriter(new FileWriter(hao ".txt"));
}catch(FileNotFoundException p){}
catch(IOException exp){}
try{
out.write(txt,0,txt.length());
out.flush();
}catch(IOException exp){}
txt="";
}
System.out.println("finished!");
}
}
public String getStrings(String s1) throws Exception
{
StringBuffer sb;
sb=new StringBuffer(s1);
while(sb.indexOf("<")!=-1)
{
int lt=sb.indexOf("<");
int rt=sb.indexOf(">");
if(lt>=rt 1) break;
sb=sb.delete(lt,rt 1);
} return sb.toString(); }
public void Reder(int hao) throws Exception
{
URL yahoo = new URL("http://app.china.com/business/enp/shwnew.php?enpid=" hao);
DataInputStream in = new DataInputStream(yahoo.openStream());
BufferedReader d= new BufferedReader(new InputStreamReader(in));
String inputLine;
for(int j=1;j<=121;j )
{
inputLine = d.readLine().trim();
}
for(int j=1;j<=40;j )
{
inputLine = d.readLine().trim();
text1.append(inputLine);
}
text1.append("/n");
in.close();
}
}
//--------------------------------
public class AcceptData
{
public static void main(String args[])
{
win window=new win();
window.pack();
}
}