第一范文网 - 专业文章范例文档资料分享平台

网络爬虫Java实现原理

来源:用户分享 时间:2025/5/25 18:18:09 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

public class CheckLinks extends javax.swing.JFrame implements Runnable,ISpiderReportable {

/**

* The constructor. Perform setup here. */

public CheckLinks() {

//{{INIT_CONTROLS

setTitle(\Broken Links\ getContentPane().setLayout(null); setSize(405,288); setVisible(true);

label1.setText(\a URL:\ getContentPane().add(label1); label1.setBounds(12,12,84,12); begin.setText(\

begin.setActionCommand(\ getContentPane().add(begin); begin.setBounds(12,36,84,24); getContentPane().add(url); url.setBounds(108,36,288,24); errorScroll.setAutoscrolls(true);

errorScroll.setHorizontalScrollBarPolicy(javax.swing.

ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); errorScroll.setVerticalScrollBarPolicy(javax.swing.

ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); errorScroll.setOpaque(true); getContentPane().add(errorScroll); errorScroll.setBounds(12,120,384,156);

errors.setEditable(false);

errorScroll.getViewport().add(errors); errors.setBounds(0,0,366,138);

current.setText(\Processing: \ getContentPane().add(current); current.setBounds(12,72,384,12); goodLinksLabel.setText(\Links: 0\ getContentPane().add(goodLinksLabel); goodLinksLabel.setBounds(12,96,192,12); badLinksLabel.setText(\Links: 0\ getContentPane().add(badLinksLabel); badLinksLabel.setBounds(216,96,96,12); //}}

//{{INIT_MENUS //}}

//{{REGISTER_LISTENERS

SymAction lSymAction = new SymAction(); begin.addActionListener(lSymAction); //}} }

/**

* Main method for the application *

* @param args Not used */

static public void main(String args[]) {

(new CheckLinks()).setVisible(true); }

/**

* Add notifications. */

public void addNotify() {

// Record the size of the window prior to calling parent's // addNotify.

Dimension size = getSize();

super.addNotify();

if ( frameSizeAdjusted ) return;

frameSizeAdjusted = true;

// Adjust size of frame according to the insets and menu bar Insets insets = getInsets();

javax.swing.JMenuBar menuBar = getRootPane().getJMenuBar(); int menuBarHeight = 0; if ( menuBar != null )

menuBarHeight = menuBar.getPreferredSize().height; setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height + menuBarHeight); }

// Used by addNotify

boolean frameSizeAdjusted = false;

//{{DECLARE_CONTROLS

javax.swing.JLabel label1 = new javax.swing.JLabel();

/**

* The begin or cancel button */

javax.swing.JButton begin = new javax.swing.JButton();

/**

* The URL being processed */

javax.swing.JTextField url = new javax.swing.JTextField();

/**

* Scroll the errors. */

javax.swing.JScrollPane errorScroll = new javax.swing.JScrollPane();

/**

* A place to store the errors created */

javax.swing.JTextArea errors = new javax.swing.JTextArea(); javax.swing.JLabel current = new javax.swing.JLabel();

javax.swing.JLabel goodLinksLabel = new javax.swing.JLabel(); javax.swing.JLabel badLinksLabel = new javax.swing.JLabel(); //}}

//{{DECLARE_MENUS //}}

/**

* The background spider thread */

protected Thread backgroundThread;

/**

* The spider object being used */

protected Spider spider;

/**

* The URL that the spider began with */

protected URL base;

/**

* How many bad links have been found */

protected int badLinksCount = 0;

/**

* How many good links have been found */

protected int goodLinksCount = 0;

/**

* Internal class used to dispatch events *

* @author wuhailin * @version 1.0 */

class SymAction implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent event) {

Object object = event.getSource(); if ( object == begin )

搜索更多关于: 网络爬虫Java实现原理 的文档
网络爬虫Java实现原理.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0463u8hrgx9da6a52izb_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top