java 网络数据接口数据爬取小脚本 源码+exe应用小程序+复制可用

可以直接添加进项目中使用,仅需改为自己想要的数据格式;
接口数据读取;
添加正则表达式或固定格式可爬取特定数据:(如邮件,电话号码,QQ号码等)
可用于在其他网站爬取数据,开发其第三方网站;
exe小程序数据保存在本地;
源码接口爬来的Json数据,需自己解析,灵活处理

皓小爬网络接口数据爬取exe

主界面入口,没有多大的实际意义,就一个装饰

package com.haoxuan.view;

import java.awt.BorderLayout;

public class CreeperOption {
   

    private static JFrame frame;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    CreeperOption window = new CreeperOption();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public CreeperOption() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frame = new JFrame();
        frame.setBounds(100, 100, 450, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocation(800, 350);

        frame.setSize(400, 400);
        //设置窗体标题
        frame.setTitle("爬虫入口");
        //设置窗口最小化时显示的图标,可选。
                Image img = new ImageIcon(this.getClass().
                             getResource("/images/001.jpg")).getImage(); 
                frame.setIconImage(img);
                MainLoginPanel loginPanel = new MainLoginPanel();
                frame.setContentPane(loginPanel);

                //设置窗口其他显示属性
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
                frame.setResizable(false);
                //注册窗口监听器
                frame.addWindowListener(new WindowsHandler());  
            }
            //登录容器panel构造,将所有控件元素装入容器
            private class MainLoginPanel extends JPanel{
   
                JLabel picLabel;
                JButton stuLoginButton,tchLoginButton;
                JPanel infoPanel;
                public MainLoginPanel(){
                //生成所有控件的对象
                picLabel =new JLabel();
                stuLoginButton = new JButton("点击跳转到信息配置界面");//构造器参数为按钮显示文本
                infoPanel=new JPanel();
                //设置MainLoginPanel布局为BorderLayout
                setLayout(new BorderLayout());

                //依次添加pic、login信息控件到面板容器, 
                //并设置infoPanel布局管理器为FlowLayout。 
                infoPanel.setLayout(new FlowLayout(FlowLayout.CENTER));

                picLabel.setSize(400, 300); 
                ImageIcon image = new ImageIcon(frame.getClass().
                                  getResource("/images/top2.jpg")); 
                image.setImage(image.getImage().getScaledInstance( picLabel.
                    getWidth(),picLabel.getHeight(), Image.SCALE_DEFAULT)); 
                 picLabel.setIcon(image);
                 infoPanel.add(picLabel);
                 infoPanel.add(stuLoginButton);
                 //让infoPanel充满整个容器
                 add(infoPanel,BorderLayout.CENTER);  
                 //生成事件监听对象
                ButtonAction buttonAction = new ButtonAction();
                //事件注册事件监听器
                stuLoginButton.addActionListener(buttonAction);
            }
            private class ButtonAction implements ActionListener{
   

                public void actionPerformed(ActionEvent e) {
                    // TODO Auto-generated method stub
                    if(e.getSource().equals(stuLoginButton)){
                        //所有swing组件必须由事件分派线程(event dispatch thread)
                        //进行配置,线程将鼠标点击和按
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值