用Swing写个scrapy爬虫图形界面 Ⅱ

因为eclipse上没有matisse form,所以不好再次修改我上次写的图形界面,所以呢,下了个Myeclipse,使用matisse form重新写了下此爬虫的GUI。

主要代码 :

/*
 * scs.java
 *
 * Created on __DATE__, __TIME__
 */

package cd.ccx;

import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.awt.TextComponent;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.Mongo;
import com.mongodb.MongoException;

/**
 *
 * @author  __USER__
 */
public class scs extends javax.swing.JFrame {
   

    public StringBuffer Download_link = new StringBuffer();

    /** Creates new form scs */
    public scs() {
        initComponents();
    }

    //GEN-BEGIN:initComponents
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        button1 = new java.awt.Button();
        label1 = new java.awt.Label();
        button2 = new java.awt.Button();
        button3 = new java.awt.Button();
        textArea1 = new java.awt.TextArea();
        label2 = new java.awt.Label();
        textField1 = new java.awt.TextField();
        button4 = new java.awt.Button();
        label3 = new java.awt.Label();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        button1.setLabel("\u5f00\u59cb\u722c\u866b :");

        button1.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {   
                String command_start="cmd /k start cmd.bat";
                //E:\\scrapy---测试用2\\GitHub\\ scrapy crawl github";
                Runtime   r=Runtime.getRuntime();
                try {

                    Process   ps=r.exec(command_start);

                } catch (IOException e) {
                    // TODO 自动生成的 catch 块
                    e.printStackTrace();
                }   
        } 

        });

        label1.setText("Scrapy crawl github");

        button2.setLabel("\u7ed3\u675f\u722c\u866b :");
        button2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            try {
                Runtime.getRuntime().exec("TaskKill /IM cmd.exe");
            } catch (IOException e1) {
                // TODO 自动生成的 catch 块
                e1.printStackTrace();
            } 
            }
        });
        button3.setLabel("\u4ece\u6570\u636e\u5e93\u4e2d\u83b7\u53d6\u4fe1\u606f :");
        button3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                button3ActionPerformed(evt);
            }
        });

        label2.setText("\u8f93\u5165\u4f60\u60f3\u4e0b\u8f7d\u7684\u9879\u76ee\uff08\u7528\u6237/\u9879\u76ee\u540d\uff09 :");

        textField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                //textField1.setText("gh");

            }
        });

        button4.setLabel("\u4e0b\u8f7d!...");
        //final String tf=textField1.getText();
        /*button4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String tf=tex
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值