⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java

📁 Java网络抓包源码
💻 JAVA
字号:
//=========================================================// 网络数据包抓取// Version:1.1// Date:  2004-3-28// Update 2004-7-3// Script Written by 李兴//=========================================================// Copyright (C) 2001-2004 5ics.Net. All rights reserved.// Web: http://www.5ics.net// Email: admin@5ics.net//=========================================================package netcap;import java.awt.*;import java.awt.event.*;import javax.swing.*;import jpcap.*;import java.io.*;public class MainFrame extends Frame {  public Jpcap jpcap;  public int deviceNum=1;  Button button_ok = new Button();  TextArea textArea1 = new TextArea();  MenuBar menuBar1 = new MenuBar();  Menu menu1 = new Menu();  MenuItem menuItem_file = new MenuItem();  Menu menu2 = new Menu();  MenuItem menuItem2 = new MenuItem();  Label label1 = new Label();  Button button1 = new Button();  Label label2 = new Label();  JComboBox jComboBox_card = new JComboBox();  JLabel jLabel1 = new JLabel();  Button button2 = new Button();  JLabel jLabel2 = new JLabel();  public MainFrame() {    addWindowListener(new WindowAdapter() {      public void windowClosing(WindowEvent e) {        dispose();        System.exit(0);      }    });    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  private void jbInit() throws Exception {    button_ok.setActionCommand("button_ok");    button_ok.setLabel("Exit");    button_ok.setLocale(java.util.Locale.getDefault());    button_ok.setVisible(true);    button_ok.setBounds(new Rectangle(381, 285, 76, 29));    button_ok.addActionListener(new MainFrame_button_ok_actionAdapter(this));    this.setLayout(null);    //textArea1.setColumns(1);    textArea1.setLocale(java.util.Locale.getDefault());   // textArea1.setRows(1);    textArea1.setText("Ip Data");    textArea1.setBounds(new Rectangle(18, 159, 572, 100));    //textArea1.SCROLLBARS_VERTICAL_ONLY;    textArea1.addMouseListener(new MainFrame_textArea1_mouseAdapter(this));    this.setMenuBar(menuBar1);    menu1.setLabel("File");    menuItem_file.setLabel("Exit");    menuItem_file.addActionListener(new MainFrame_menuItem1_actionAdapter(this));    menu2.setLabel("Help");    menuItem2.setLabel("About");    label1.setFont(new java.awt.Font("Dialog", 1, 11));    label1.setText("Capture On device");    label1.setBounds(new Rectangle(18, 48, 573, 25));    button1.setLabel("Pause");    button1.setBounds(new Rectangle(259, 285, 80, 28));    button1.addActionListener(new MainFrame_button1_actionAdapter(this));    button1.addMouseListener(new MainFrame_button1_mouseAdapter(this));    label2.setFont(new java.awt.Font("Dialog", 1, 11));    label2.setText("Captured 0 Packet");    label2.setBounds(new Rectangle(18, 76, 277, 28));    jComboBox_card.setBounds(new Rectangle(115, 112, 478, 24));    jComboBox_card.addMouseMotionListener(new MainFrame_jComboBox_card_mouseMotionAdapter(this));    jComboBox_card.addMouseListener(new MainFrame_jComboBox_card_mouseAdapter(this));    jLabel1.setText("Select NetCard");    jLabel1.setBounds(new Rectangle(19, 111, 90, 25));    button2.setLabel("Start");    button2.setBounds(new Rectangle(133, 287, 72, 26));    button2.addMouseListener(new MainFrame_button2_mouseAdapter(this));    jLabel2.setFont(new java.awt.Font("Dialog", 1, 11));    jLabel2.setText("Captured 0 byte Data");    jLabel2.setBounds(new Rectangle(349, 76, 241, 28));    this.add(textArea1, null);    this.add(label1, null);    this.add(jComboBox_card, null);    this.add(jLabel1, null);    this.add(button1, null);    this.add(button_ok, BorderLayout.CENTER);    this.add(button2, null);    this.add(jLabel2, null);    this.add(label2, null);    menuBar1.add(menu1);    menuBar1.add(menu2);    menu1.add(menuItem_file);    menu2.add(menuItem2);  }  void button_ok_actionPerformed(ActionEvent e) {    dispose();    System.exit(0);  }  void menuItem1_actionPerformed(ActionEvent e) {    dispose();    System.exit(0);  }  void button1_mouseClicked(MouseEvent e) {  if(button1.getLabel()=="Pause"){        button1.setLabel("Continue");      }  else    {      button1.setLabel("Pause");    }  }  void jComboBox_card_mouseEntered(MouseEvent e){    deviceNum=jComboBox_card.getSelectedIndex(); }  void button1_actionPerformed(ActionEvent e) {  }  void button2_mouseClicked(MouseEvent e) {    if(button2.getLabel()=="Start"){          button2.setLabel("Stop");          button2.enable(false);        }  }  void jComboBox_card_mouseReleased(MouseEvent e) {    deviceNum=jComboBox_card.getSelectedIndex();  }}class MainFrame_menuItem1_actionAdapter implements java.awt.event.ActionListener {  MainFrame adaptee;  MainFrame_menuItem1_actionAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.menuItem1_actionPerformed(e);  }  }class MainFrame_button_ok_actionAdapter implements java.awt.event.ActionListener {  MainFrame adaptee;  MainFrame_button_ok_actionAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.button_ok_actionPerformed(e);  }}class MainFrame_button1_mouseAdapter extends java.awt.event.MouseAdapter {  MainFrame adaptee;  MainFrame_button1_mouseAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void mouseClicked(MouseEvent e) {    adaptee.button1_mouseClicked(e);  }}class MainFrame_jComboBox_card_mouseAdapter extends java.awt.event.MouseAdapter {  MainFrame adaptee;  MainFrame_jComboBox_card_mouseAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void mouseEntered(MouseEvent e){    adaptee.jComboBox_card_mouseEntered(e);  }  public void mouseReleased(MouseEvent e) {    adaptee.jComboBox_card_mouseReleased(e);  }}class MainFrame_textArea1_mouseAdapter extends java.awt.event.MouseAdapter {  MainFrame adaptee;  MainFrame_textArea1_mouseAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  } }class MainFrame_button1_actionAdapter implements java.awt.event.ActionListener {  MainFrame adaptee;  MainFrame_button1_actionAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.button1_actionPerformed(e);  }}class MainFrame_button2_mouseAdapter extends java.awt.event.MouseAdapter {  MainFrame adaptee;  MainFrame_button2_mouseAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void mouseClicked(MouseEvent e) {    adaptee.button2_mouseClicked(e);  }}class MainFrame_jComboBox_card_mouseMotionAdapter extends java.awt.event.MouseMotionAdapter {  MainFrame adaptee;  MainFrame_jComboBox_card_mouseMotionAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -