Пример #1
0
  private void StartButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_StartButtonActionPerformed
    // TODO add your handling code here:
    index = NICSelectComboBox.getSelectedIndex();
    NICSelectComboBox.setEnabled(false);
    StartButton.setEnabled(false);
    StopButton.setEnabled(true);
    ps.startMonitor(index);

    if (firstrun) {
      t.start();
      firstrun = false;
    } else t.resume();
  } // GEN-LAST:event_StartButtonActionPerformed
Пример #2
0
  private void StopButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_StopButtonActionPerformed
    // TODO add your handling code here:
    NICSelectComboBox.setEnabled(true);

    try {

      StartButton.setEnabled(true);
      t.suspend();

    } catch (Exception e) {
      System.out.println("Stop Button Exception:" + e);
    }
    StopButton.setEnabled(false);
  } // GEN-LAST:event_StopButtonActionPerformed
 public void notifyStopRecord() {
   mPlayPause.update();
   mStop.update();
   if (mRecord != null) mRecord.update();
 }
 public void notifyStop() {
   // Send state change signal to all buttons
   mPlayPause.update();
   mStop.update();
   if (mRecord != null) mRecord.update();
 }
Пример #5
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    StartButton = new javax.swing.JButton();
    StopButton = new javax.swing.JButton();
    ClearButton = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    IPTable = new javax.swing.JTable();
    jScrollPane2 = new javax.swing.JScrollPane();
    PacketInfoTable = new javax.swing.JTable();
    StartLabel = new javax.swing.JLabel();
    StopLabel = new javax.swing.JLabel();
    ClearLabel = new javax.swing.JLabel();
    NICSelectComboBox = new javax.swing.JComboBox();
    NICSelectLabel = new javax.swing.JLabel();
    TextButton = new javax.swing.JButton();
    TextLabel = new javax.swing.JLabel();
    SpeedDisplay = new javax.swing.JLabel();
    jScrollPane3 = new javax.swing.JScrollPane();
    PacketDataTextArea = new javax.swing.JTextArea();
    jLabel1 = new javax.swing.JLabel();
    jButton1 = new javax.swing.JButton();
    SelectIPButton = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jButton3 = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setForeground(new java.awt.Color(204, 255, 0));

    StartButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/icons/startup1.jpg"))); // NOI18N
    StartButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            StartButtonActionPerformed(evt);
          }
        });

    StopButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/icons/stop.jpg"))); // NOI18N
    StopButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            StopButtonActionPerformed(evt);
          }
        });

    ClearButton.setFont(new java.awt.Font("Nina", 1, 8));
    ClearButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/icons/clear1.JPG"))); // NOI18N
    ClearButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ClearButtonActionPerformed(evt);
          }
        });

    IPTable.setModel(
        new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] {"IP"}) {

          boolean[] canEdit = new boolean[] {false};

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        });
    IPTable.setColumnSelectionAllowed(true);
    IPTable.setGridColor(new java.awt.Color(255, 255, 255));
    IPTable.getTableHeader().setReorderingAllowed(false);
    jScrollPane1.setViewportView(IPTable);
    IPTable.getColumnModel()
        .getSelectionModel()
        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

    PacketInfoTable.setModel(
        new javax.swing.table.DefaultTableModel(
            new Object[][] {},
            new String[] {
              "Time ",
              "Source IP",
              "Destination IP",
              "Length",
              "Protocol",
              "Data Length",
              "Time Stamp"
            }) {
          boolean[] canEdit = new boolean[] {false, false, false, false, false, false, false};

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        });
    jScrollPane2.setViewportView(PacketInfoTable);

    StartLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
    StartLabel.setForeground(new java.awt.Color(51, 51, 255));
    StartLabel.setText("START");

    StopLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
    StopLabel.setForeground(new java.awt.Color(51, 51, 255));
    StopLabel.setText("STOP");

    ClearLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
    ClearLabel.setForeground(new java.awt.Color(0, 0, 255));
    ClearLabel.setText("CLEAR ALL");

    NICSelectLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
    NICSelectLabel.setForeground(new java.awt.Color(204, 0, 51));
    NICSelectLabel.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/icons/networkinter.JPG"))); // NOI18N
    NICSelectLabel.setText("Network Interface");

    TextButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/icons/icon-text.gif"))); // NOI18N
    TextButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            TextButtonActionPerformed(evt);
          }
        });

    TextLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
    TextLabel.setForeground(new java.awt.Color(0, 0, 255));
    TextLabel.setText("    TEXT");

    SpeedDisplay.setLabelFor(SpeedDisplay);
    SpeedDisplay.setText("Speed: 0.0 bps");

    PacketDataTextArea.setColumns(20);
    PacketDataTextArea.setEditable(false);
    PacketDataTextArea.setRows(5);
    jScrollPane3.setViewportView(PacketDataTextArea);

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
    jLabel1.setText("PACKET CONTENT");

    jButton1.setText("Clear Text");
    jButton1.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
          }
        });

    SelectIPButton.setText("Select IP");
    SelectIPButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            SelectIPButtonActionPerformed(evt);
          }
        });

    jButton2.setText("About Us");
    jButton2.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
          }
        });

    jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14));
    jLabel2.setText("Packet Information:");

    jButton3.setText("Get Details by Domain Name");
    jButton3.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(20, 20, 20)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        StartButton,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        35,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(
                                                        StopButton,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        36,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(StartLabel)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(StopLabel))
                                            .addComponent(SelectIPButton))
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING)
                                                            .addGroup(
                                                                layout
                                                                    .createSequentialGroup()
                                                                    .addGap(32, 32, 32)
                                                                    .addComponent(
                                                                        ClearButton,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE,
                                                                        33,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE))
                                                            .addGroup(
                                                                layout
                                                                    .createSequentialGroup()
                                                                    .addGap(18, 18, 18)
                                                                    .addComponent(ClearLabel)))
                                                    .addGap(18, 18, 18)
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING)
                                                            .addGroup(
                                                                layout
                                                                    .createSequentialGroup()
                                                                    .addGap(93, 93, 93)
                                                                    .addComponent(
                                                                        SpeedDisplay,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE,
                                                                        122,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE))
                                                            .addGroup(
                                                                layout
                                                                    .createParallelGroup(
                                                                        javax.swing.GroupLayout
                                                                            .Alignment.TRAILING)
                                                                    .addComponent(jLabel2)
                                                                    .addGroup(
                                                                        layout
                                                                            .createSequentialGroup()
                                                                            .addComponent(
                                                                                NICSelectLabel,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE,
                                                                                158,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE)
                                                                            .addPreferredGap(
                                                                                javax.swing
                                                                                    .LayoutStyle
                                                                                    .ComponentPlacement
                                                                                    .RELATED)
                                                                            .addComponent(
                                                                                NICSelectComboBox,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE,
                                                                                185,
                                                                                javax.swing
                                                                                    .GroupLayout
                                                                                    .PREFERRED_SIZE)))))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGap(26, 26, 26)
                                                    .addComponent(jButton3)))
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGap(55, 55, 55)
                                                    .addComponent(
                                                        TextButton,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        45,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .UNRELATED)
                                                    .addComponent(jButton1))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGap(49, 49, 49)
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING)
                                                            .addComponent(jButton2)
                                                            .addComponent(
                                                                TextLabel,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE,
                                                                74,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE)))))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jScrollPane1,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        155,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGap(228, 228, 228)
                                                    .addComponent(
                                                        jLabel1,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        152,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGap(10, 10, 10)
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING,
                                                                false)
                                                            .addComponent(jScrollPane3)
                                                            .addComponent(
                                                                jScrollPane2,
                                                                javax.swing.GroupLayout
                                                                    .DEFAULT_SIZE,
                                                                668,
                                                                Short.MAX_VALUE))))))
                    .addContainerGap(269, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(20, 20, 20)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING,
                                                                false)
                                                            .addGroup(
                                                                layout
                                                                    .createParallelGroup(
                                                                        javax.swing.GroupLayout
                                                                            .Alignment.BASELINE)
                                                                    .addComponent(NICSelectLabel)
                                                                    .addComponent(
                                                                        NICSelectComboBox,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout
                                                                            .DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE))
                                                            .addComponent(
                                                                jButton1,
                                                                javax.swing.GroupLayout
                                                                    .DEFAULT_SIZE,
                                                                53,
                                                                Short.MAX_VALUE))
                                                    .addGap(6, 6, 6))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        TextButton,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .RELATED)))
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGap(16, 16, 16)
                                                    .addComponent(SpeedDisplay))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(TextLabel)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .RELATED)
                                                    .addComponent(
                                                        jButton2,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        45,
                                                        Short.MAX_VALUE)))
                                    .addGap(9, 9, 9)
                                    .addComponent(jLabel2)
                                    .addGap(6, 6, 6))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(
                                                StartButton,
                                                javax.swing.GroupLayout.Alignment.LEADING,
                                                0,
                                                0,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                StopButton,
                                                javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        8,
                                        Short.MAX_VALUE)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(StartLabel)
                                            .addComponent(StopLabel)
                                            .addComponent(ClearLabel))
                                    .addGap(53, 53, 53)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jButton3)
                                            .addComponent(SelectIPButton))
                                    .addGap(21, 21, 21))
                            .addComponent(ClearButton))
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jScrollPane2,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        294,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel1)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        jScrollPane3,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        145,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                jScrollPane1,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                468,
                                Short.MAX_VALUE))
                    .addGap(21, 21, 21)));

    layout.linkSize(
        javax.swing.SwingConstants.VERTICAL,
        new java.awt.Component[] {ClearButton, StartButton, StopButton});

    pack();
  } // </editor-fold>//GEN-END:initComponents