content: /*
   * ControlPanel.java
   * Created by John Melton G0ORX
   * Created on 01-Feb-2010, 12:47:52
   * 
   */
  
  /*
   * This code has been and reviewed modified.
   * John Tucker, N8MDP
   */
  
  /*
   * Revsion History
   * 1/20/13: Changes:
   *              1. public void updatedVFO ()
   *                  A. Added code to properly set the mode (e.g. LSB, USB..)
   *                  B. Added code to set the Master/Slave mode indicator
   *                  C. Added code to update the Digital Meter.
   * 		2. Added two new functions for the UP/DN VFO
   *                  A. private void freqUpActionPerformed
   *                      => Increases the VFO setting by 1000Hz	
   *                  B. private void freqDownActionPerformed
   *			=> Decreases the VFO setting by 1000Hz	
   * 
   */
  
  package jmonitor;
  
  import java.awt.Color;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.text.DecimalFormat;
  import javax.swing.ButtonGroup;
  import javax.swing.JCheckBoxMenuItem;
  import javax.swing.JPopupMenu;
  import javax.swing.JRadioButtonMenuItem;
  
  public class ControlPanel extends javax.swing.JPanel {
  
      /** Creates new form ControlPanel */
      public ControlPanel() {
          initComponents();
  
          vfo.setCaretColor(Color.WHITE);
      
          createLSBFilterMenu();
          createBandMenu();
          createModeMenu();
          createAGCMenu();
          createDSPMenu();
          createGainMenu();
      }
  
      public void setClient(Client client) {
          this.client=client;
      }
  
      
      // I am adding this code to just update the Frequency VFO and the String Mode
      public void updateVFO () {
          frequency=client.getFrequency();
          String fString=mhzFormat.format(frequency/1000000)+"."+khzFormat.format(frequency%1000000);
          vfo.setText(fString); 
          modeString=client.getStringMode();
          mode.setText(modeString);
          msID.setText(client.getmsMode());
          digitalMeter.update(client.getMeter());
      }
   
      public void update() {
  // Not sure this function is even called!!! Will review
          if(client.getFrequency()!=frequency) {
              frequency=client.getFrequency();
              String fString=mhzFormat.format(frequency/1000000)+"."+khzFormat.format(frequency%1000000);
              vfo.setText(fString);
          }
  
          if(!modeString.equals(client.getStringMode())) {
              modeString=client.getStringMode();
              mode.setText(client.getStringMode());
          }
          
          digitalMeter.update(client.getMeter());
          
  
      }
     
      /** 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() {
  
          jButton1 = new javax.swing.JButton();
          button2 = new java.awt.Button();
          panel1 = new java.awt.Panel();
          panel2 = new java.awt.Panel();
          bandButton = new javax.swing.JButton();
          modeButton = new javax.swing.JButton();
          vfo = new javax.swing.JTextField();
          mode = new javax.swing.JTextField();
          digitalMeter = new jmonitor.DigitalMeter();
          filterButton = new javax.swing.JButton();
          agcButton = new javax.swing.JButton();
          dspButton = new javax.swing.JButton();
          afgainButton = new javax.swing.JButton();
          msID = new javax.swing.JTextField();
          jScrollBar1 = new javax.swing.JScrollBar();
          freqUp = new java.awt.Button();
          freqDown = new java.awt.Button();
  
          jButton1.setText("jButton1");
  
          button2.setLabel("button2");
  
          javax.swing.GroupLayout panel1Layout = new javax.swing.GroupLayout(panel1);
          panel1.setLayout(panel1Layout);
          panel1Layout.setHorizontalGroup(
              panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 100, Short.MAX_VALUE)
          );
          panel1Layout.setVerticalGroup(
              panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 100, Short.MAX_VALUE)
          );
  
          javax.swing.GroupLayout panel2Layout = new javax.swing.GroupLayout(panel2);
          panel2.setLayout(panel2Layout);
          panel2Layout.setHorizontalGroup(
              panel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 100, Short.MAX_VALUE)
          );
          panel2Layout.setVerticalGroup(
              panel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 100, Short.MAX_VALUE)
          );
  
          setMaximumSize(new java.awt.Dimension(480, 27));
          setMinimumSize(new java.awt.Dimension(480, 27));
          setPreferredSize(new java.awt.Dimension(480, 27));
          setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
  
          bandButton.setFont(new java.awt.Font("DejaVu Sans", 0, 12)); // NOI18N
          bandButton.setText("Band");
          bandButton.setAlignmentY(0.0F);
          bandButton.setMaximumSize(new java.awt.Dimension(90, 27));
          bandButton.setMinimumSize(new java.awt.Dimension(90, 27));
          bandButton.setPreferredSize(new java.awt.Dimension(90, 27));
          bandButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  bandButtonActionPerformed(evt);
              }
          });
          add(bandButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 90, -1));
  
          modeButton.setFont(new java.awt.Font("DejaVu Sans", 0, 12)); // NOI18N
          modeButton.setText("Mode");
          modeButton.setAlignmentY(0.0F);
          modeButton.setMaximumSize(new java.awt.Dimension(90, 27));
          modeButton.setMinimumSize(new java.awt.Dimension(90, 27));
          modeButton.setPreferredSize(new java.awt.Dimension(90, 27));
          modeButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  modeButtonActionPerformed(evt);
              }
          });
          add(modeButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 30, 90, -1));
  
          vfo.setBackground(new java.awt.Color(0, 0, 0));
          vfo.setFont(new java.awt.Font("FreeMono", 1, 24)); // NOI18N
          vfo.setForeground(new java.awt.Color(0, 255, 0));
          vfo.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
          vfo.setText("7.048.000");
          vfo.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
          vfo.setMaximumSize(new java.awt.Dimension(178, 26));
          vfo.setMinimumSize(new java.awt.Dimension(178, 26));
          vfo.setPreferredSize(new java.awt.Dimension(178, 26));
          vfo.addMouseListener(new java.awt.event.MouseAdapter() {
              public void mouseClicked(java.awt.event.MouseEvent evt) {
                  vfoMouseClicked(evt);
              }
          });
          vfo.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  vfoActionPerformed(evt);
              }
          });
          add(vfo, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 20, 150, 40));
  
          mode.setEditable(false);
          mode.setBackground(new java.awt.Color(0, 0, 0));
          mode.setFont(new java.awt.Font("DejaVu Sans", 1, 14)); // NOI18N
          mode.setForeground(new java.awt.Color(0, 255, 0));
          mode.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
          mode.setText("LSB");
          mode.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
          add(mode, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 30, 50, 30));
  
          digitalMeter.setPreferredSize(new java.awt.Dimension(120, 27));
  
          javax.swing.GroupLayout digitalMeterLayout = new javax.swing.GroupLayout(digitalMeter);
          digitalMeter.setLayout(digitalMeterLayout);
          digitalMeterLayout.setHorizontalGroup(
              digitalMeterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 140, Short.MAX_VALUE)
          );
          digitalMeterLayout.setVerticalGroup(
              digitalMeterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 23, Short.MAX_VALUE)
          );
  
          add(digitalMeter, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 0, 140, 20));
  
          filterButton.setFont(new java.awt.Font("DejaVu Sans", 0, 12)); // NOI18N
          filterButton.setText("Filter");
          filterButton.setMaximumSize(new java.awt.Dimension(90, 27));
          filterButton.setMinimumSize(new java.awt.Dimension(90, 27));
          filterButton.setPreferredSize(new java.awt.Dimension(90, 27));
          filterButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  filterButtonActionPerformed(evt);
              }
          });
          add(filterButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 0, 80, -1));
  
          agcButton.setFont(new java.awt.Font("DejaVu Sans", 0, 12)); // NOI18N
          agcButton.setText("AGC");
          agcButton.setMaximumSize(new java.awt.Dimension(90, 27));
          agcButton.setMinimumSize(new java.awt.Dimension(90, 27));
          agcButton.setPreferredSize(new java.awt.Dimension(90, 27));
          agcButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  agcButtonActionPerformed(evt);
              }
          });
          add(agcButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 30, 80, -1));
  
          dspButton.setFont(new java.awt.Font("DejaVu Sans", 0, 12)); // NOI18N
          dspButton.setText("DSP");
          dspButton.setMaximumSize(new java.awt.Dimension(90, 27));
          dspButton.setMinimumSize(new java.awt.Dimension(90, 27));
          dspButton.setPreferredSize(new java.awt.Dimension(90, 27));
          dspButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  dspButtonActionPerformed(evt);
              }
          });
          add(dspButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 0, 80, -1));
  
          afgainButton.setFont(new java.awt.Font("DejaVu Sans", 0, 12)); // NOI18N
          afgainButton.setText("AFGain");
          afgainButton.setMaximumSize(new java.awt.Dimension(90, 27));
          afgainButton.setMinimumSize(new java.awt.Dimension(90, 27));
          afgainButton.setPreferredSize(new java.awt.Dimension(90, 27));
          afgainButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  afgainButtonActionPerformed(evt);
              }
          });
          add(afgainButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 30, 80, -1));
  
          msID.setEditable(false);
          msID.setBackground(new java.awt.Color(0, 0, 0));
          msID.setFont(new java.awt.Font("Arial", 1, 10)); // NOI18N
          msID.setForeground(new java.awt.Color(0, 255, 0));
          msID.setHorizontalAlignment(javax.swing.JTextField.CENTER);
          msID.setText("Master-Mode");
          msID.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  msIDActionPerformed(evt);
              }
          });
          add(msID, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 0, 80, -1));
          add(jScrollBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 30, -1, -1));
  
          freqUp.setBackground(new java.awt.Color(255, 255, 255));
          freqUp.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N
          freqUp.setLabel("UP");
          freqUp.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  freqUpActionPerformed(evt);
              }
          });
          add(freqUp, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 20, 30, 20));
  
          freqDown.setBackground(new java.awt.Color(255, 255, 255));
          freqDown.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N
          freqDown.setLabel("DN");
          freqDown.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  freqDownActionPerformed(evt);
              }
          });
          add(freqDown, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 40, 30, 20));
      }// </editor-fold>//GEN-END:initComponents
  
      private void createBandMenu() {
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item;
  
          bandMenu = new JPopupMenu("Band");
          
          item=new JRadioButtonMenuItem("160");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(1850000);
                  client.setFilter(-3440, -150);
                  client.setMode(Client.modeLSB);
                  lsb.setSelected(true);
                  createLSBFilterMenu();
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item = new JRadioButtonMenuItem("80");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(3790000);
                  client.setFilter(-3440, -150);
                  client.setMode(Client.modeLSB);
                  lsb.setSelected(true);
                  createLSBFilterMenu();
              }
          });group.add(item);
          bandMenu.add(item);
  
  
          item=new JRadioButtonMenuItem("60");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(5371500);
                  client.setFilter(-3440, -150);
                  client.setMode(Client.modeLSB);
                  createLSBFilterMenu();
                  lsb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("40");
          item.setSelected(true);
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(7048000);
                  client.setFilter(-3440, -150);
                  client.setMode(Client.modeLSB);
                  createLSBFilterMenu();
                  lsb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("30");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(10135600);
                  client.setFilter(150,3440);
                  client.setMode(Client.modeUSB);
                  createUSBFilterMenu();
                  lsb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("20");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(14200000);
                  client.setFilter(150,3440);
                  client.setMode(Client.modeUSB);
                  createUSBFilterMenu();
                  usb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("17");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(18118900);
                  client.setFilter(150,3440);
                  client.setMode(Client.modeUSB);
                  createUSBFilterMenu();
                  usb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("15");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(21200000);
                  client.setFilter(150,3440);
                  client.setMode(Client.modeUSB);
                  createUSBFilterMenu();
                  usb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("12");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(24910000);
                  client.setFilter(150,3440);
                  client.setMode(Client.modeUSB);
                  createUSBFilterMenu();
                  usb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("10");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(28500000);
                  client.setFilter(150,3440);
                  client.setMode(Client.modeUSB);
                  createUSBFilterMenu();
                  usb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("6");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(50200000);
                  client.setFilter(150,3440);
                  client.setMode(Client.modeUSB);
                  createUSBFilterMenu();
                  usb.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("GEN");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(909000);
                  client.setFilter(-4000,4000);
                  client.setMode(Client.modeAM);
                  createAMFilterMenu();
                  am.setSelected(true);
              }
  
          });
          group.add(item);
          bandMenu.add(item);
  
          item=new JRadioButtonMenuItem("WWV");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFrequency(5000000);
                  client.setFilter(-4000,4000);
                  client.setMode(Client.modeSAM);
                  createAMFilterMenu();
                  sam.setSelected(true);
              }
          });
          group.add(item);
          bandMenu.add(item);
  
      }
  
      private void createModeMenu() {
  
          ButtonGroup group=new ButtonGroup();
  
          JRadioButtonMenuItem item;
  
          modeMenu = new JPopupMenu("Mode");
          
          item=new JRadioButtonMenuItem("LSB");
          lsb=item;
          item.setSelected(true);
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(0);
                  client.setFilter(-2850, -150);
                  createLSBFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("USB");
          usb=item;
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(1);
                  client.setFilter(150, 2850);
                  createUSBFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("DSB");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(2);
                  client.setFilter(-2600, 2600);
                  createAMFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("CWL");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(3);
                  client.setFilter(-800, -400);
                  createCWFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("CWU");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(4);
                  client.setFilter(400, 800);
                  createCWFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("SPEC");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(8);
                  client.setFilter(-6000, -6000);
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("DIGL");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(9);
                  client.setFilter(-3450, -150);
                  createDIGLFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("DIGU");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(7);
                  client.setFilter(150, 3450);
                  createDIGUFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("DRM");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(11);
                  client.setFilter(-6000, 6000);
                  filterMenu=null;
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("AM");
          am=item;
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(6);
                  client.setFilter(-4000,4000);
                  createAMFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("SAM");
          sam=item;
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(10);
                  client.setFilter(-4000,4000);
                  createAMFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
          item = new JRadioButtonMenuItem("FMN");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setMode(5);
                  client.setFilter(-2600, 2600);
                  createAMFilterMenu();
              }
          });
          group.add(item);
          modeMenu.add(item);
  
      }
  
      private void bandButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bandButtonActionPerformed
          bandMenu.show(bandButton, 0, 0);
      }//GEN-LAST:event_bandButtonActionPerformed
  
      private void modeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modeButtonActionPerformed
          modeMenu.show(modeButton, 0, 0);
      }//GEN-LAST:event_modeButtonActionPerformed
  
      private void filterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filterButtonActionPerformed
          if(filterMenu!=null) {
              filterMenu.show(filterButton, 0, 0);
          }
      }//GEN-LAST:event_filterButtonActionPerformed
  
      private void agcButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agcButtonActionPerformed
          if(agcMenu!=null) {
              agcMenu.show(agcButton, 0, 0);
          }
      }//GEN-LAST:event_agcButtonActionPerformed
  
      private void dspButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dspButtonActionPerformed
          if(dspMenu!=null) {
              dspMenu.show(dspButton, 0, 0);
          }
      }//GEN-LAST:event_dspButtonActionPerformed
  
      private void vfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vfoActionPerformed
          // This function no longer works due to the timer updates... JLT
          // user has entered a frequency
          String s=vfo.getText().replace(".","");
          try {
              long f=Long.parseLong(s);
              client.setFrequency(f);
          } catch (Exception e) {
              // force repaint
              frequency=0L;
          }
      }//GEN-LAST:event_vfoActionPerformed
  
      private void afgainButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_afgainButtonActionPerformed
          if(gainMenu!=null) {
              gainMenu.show(afgainButton,0,0);
          }
      }//GEN-LAST:event_afgainButtonActionPerformed
  
      private void vfoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_vfoMouseClicked
          // look for right mouse event
          if(evt.getButton()==evt.BUTTON3) {
  
          }
      }//GEN-LAST:event_vfoMouseClicked
  
      private void msIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_msIDActionPerformed
          // TODO add your handling code here:
      }//GEN-LAST:event_msIDActionPerformed
  
      private void freqUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_freqUpActionPerformed
          client.setFrequency(client.getFrequency()+1000);
      }//GEN-LAST:event_freqUpActionPerformed
  
      private void freqDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_freqDownActionPerformed
          client.setFrequency(client.getFrequency()-1000);
      }//GEN-LAST:event_freqDownActionPerformed
  
      private void createLSBFilterMenu() {
  
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item;
  
          filterMenu = new JPopupMenu("Filter");
  
  
          item=new JRadioButtonMenuItem("5.0k");
          item.addActionListener (new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-5150,-150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("4.4k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-4550, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.8k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-3950, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.3k");
          item.setSelected(true);
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-3440, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.9k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-3050, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.7k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2850, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.4k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2550, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.1k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2250, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.8k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-1950, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-1150, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
      }
  
      private void createUSBFilterMenu() {
  
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item;
  
          filterMenu = new JPopupMenu("Filter");
  
          item=new JRadioButtonMenuItem("5.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,5150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("4.4k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,4550);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.8k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,3950);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.3k");
          item.setSelected(true);
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,3440);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.9k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,3050);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.7k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,2850);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.4k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,2550);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.1k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,2250);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.8k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,1950);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150,1150);
              }
          });
          group.add(item);
          filterMenu.add(item);
      }
  
      private void createCWFilterMenu() {
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item=new JRadioButtonMenuItem();
  
          filterMenu = new JPopupMenu("Filter");
  
          item=new JRadioButtonMenuItem("1.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-500,-client.getCWPitch()+500);
                  } else {
                      client.setFilter(client.getCWPitch()-500,client.getCWPitch()+500);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("800");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-400,-client.getCWPitch()+400);
                  } else {
                      client.setFilter(client.getCWPitch()-400,client.getCWPitch()+400);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("750");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-375,-client.getCWPitch()+375);
                  } else {
                      client.setFilter(client.getCWPitch()-375,client.getCWPitch()+375);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("600");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-300,-client.getCWPitch()+300);
                  } else {
                      client.setFilter(client.getCWPitch()-300,client.getCWPitch()+300);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("500");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-250,-client.getCWPitch()+250);
                  } else {
                      client.setFilter(client.getCWPitch()-250,client.getCWPitch()+250);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("400");
          item.setSelected(true);
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-200,-client.getCWPitch()+200);
                  } else {
                      client.setFilter(client.getCWPitch()-200,client.getCWPitch()+200);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("250");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-125,-client.getCWPitch()+125);
                  } else {
                      client.setFilter(client.getCWPitch()-125,client.getCWPitch()+125);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("100");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-50,-client.getCWPitch()+50);
                  } else {
                      client.setFilter(client.getCWPitch()-50,client.getCWPitch()+50);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("50");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-25,-client.getCWPitch()+25);
                  } else {
                      client.setFilter(client.getCWPitch()-25,client.getCWPitch()+25);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("25");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  if(client.getMode()==Client.modeCWL) {
                      client.setFilter(-client.getCWPitch()-13,-client.getCWPitch()+13);
                  } else {
                      client.setFilter(client.getCWPitch()-13,client.getCWPitch()+13);
                  }
              }
          });
          group.add(item);
          filterMenu.add(item);
      }
  
  
      private void createDIGLFilterMenu() {
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item=new JRadioButtonMenuItem();
  
          filterMenu = new JPopupMenu("Filter");
  
          item=new JRadioButtonMenuItem("5.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-5150, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("4.4k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-4550, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.8k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-3950, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.3k");
          item.setSelected(true);
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-3440, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.9k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-3050, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.7k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2850, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.4k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2550, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.1");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2250, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.8k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-1950, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-1150, -150);
              }
          });
          group.add(item);
          filterMenu.add(item);
      }
  
      private void createDIGUFilterMenu() {
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item;
  
          filterMenu = new JPopupMenu("Filter");
          
          item=new JRadioButtonMenuItem("5.0k");
          filterMenu.add("5.0k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 5150);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("4.4k");
          filterMenu.add("4.4k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 4550);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.8k");
          filterMenu.add("3.8k").addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 3950);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.3k");
          item.setSelected(true);
          filterMenu.add("3.3k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 3440);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.9k");
          filterMenu.add("2.9k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 3050);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.7k");
          filterMenu.add("2.7k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 2850);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.4k");
          filterMenu.add("2.4k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 2550);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.1k");
          filterMenu.add("2.1k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 2250);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.8k");
          filterMenu.add("1.8k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 1950);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("1.0k");
          filterMenu.add("1.0k").addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(150, 1150);
              }
          });
          group.add(item);
          filterMenu.add(item);
      }
  
      private void createAMFilterMenu() {
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item;
  
          filterMenu = new JPopupMenu("Filter");
          
          item=new JRadioButtonMenuItem("16.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-8000,8000);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("12.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-6000,6000);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("10.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-5000,5000);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("8.0k");
          item.setSelected(true);
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-4000,4000);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("6.6k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-3300,3300);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("5.2k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2600,2600);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("4.0k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-2000,2000);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("3.1k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-1550,1550);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.9k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-1450,1450);
              }
          });
          group.add(item);
          filterMenu.add(item);
  
          item=new JRadioButtonMenuItem("2.4k");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setFilter(-1200,1200);
              }
          });
          group.add(item);
          filterMenu.add(item);
      }
  
      private void createAGCMenu() {
          ButtonGroup group=new ButtonGroup();
          JRadioButtonMenuItem item;
  
          agcMenu = new JPopupMenu("AGC");
          item=new JRadioButtonMenuItem("Long");
          item.setSelected(true);
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setAGC(1);
              }
          });
          group.add(item);
          agcMenu.add(item);
  
          item=new JRadioButtonMenuItem("Slow");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setAGC(2);
              }
          });
          group.add(item);
          agcMenu.add(item);
  
          item=new JRadioButtonMenuItem("Medium");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setAGC(3);
              }
          });
          group.add(item);
          agcMenu.add(item);
  
          item=new JRadioButtonMenuItem("Fast");
          item.addActionListener(new java.awt.event.ActionListener() {
  
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  client.setAGC(4);
              }
          });
          group.add(item);
          agcMenu.add(item);
      }
  
      private void createDSPMenu() {
          dspMenu = new JPopupMenu("DSP");
          JCheckBoxMenuItem item=new JCheckBoxMenuItem("NR");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setNR(item.getState());
             }
          });
          dspMenu.add(item);
          item=new JCheckBoxMenuItem("ANF");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setANF(item.getState());
             }
          });
          dspMenu.add(item);
          item=new JCheckBoxMenuItem("NB");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setNB(item.getState());
             }
          });
          dspMenu.add(item);
      }
  
      private void createGainMenu() {
          ButtonGroup group=new ButtonGroup();
          gainMenu = new JPopupMenu("AF Gain");
          JCheckBoxMenuItem item=new JCheckBoxMenuItem("0");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(0);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("10");
  
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(10);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("20");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(20);
             }
          });
          gainMenu.add(item);
          group.add(item);
          
          item=new JCheckBoxMenuItem("30");
          item.setSelected(true);
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(30);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("40");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(40);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("50");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(50);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("60");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(60);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("70");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(70);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("80");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(80);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("90");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(90);
             }
          });
          gainMenu.add(item);
          group.add(item);
          item=new JCheckBoxMenuItem("100");
          item.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 JCheckBoxMenuItem item=(JCheckBoxMenuItem)evt.getSource();
                 client.setGain(100);
             }
          });
          gainMenu.add(item);
          group.add(item);
      }
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JButton afgainButton;
      private javax.swing.JButton agcButton;
      private javax.swing.JButton bandButton;
      private java.awt.Button button2;
      private jmonitor.DigitalMeter digitalMeter;
      private javax.swing.JButton dspButton;
      private javax.swing.JButton filterButton;
      private java.awt.Button freqDown;
      private java.awt.Button freqUp;
      private javax.swing.JButton jButton1;
      private javax.swing.JScrollBar jScrollBar1;
      private javax.swing.JTextField mode;
      private javax.swing.JButton modeButton;
      public javax.swing.JTextField msID;
      private java.awt.Panel panel1;
      private java.awt.Panel panel2;
      private javax.swing.JTextField vfo;
      // End of variables declaration//GEN-END:variables
  
      private Client client;
  
      private JPopupMenu bandMenu;
      private JPopupMenu modeMenu;
      private JPopupMenu filterMenu;
      private JPopupMenu agcMenu;
      private JPopupMenu dspMenu;
      private JPopupMenu gainMenu;
  
      private JRadioButtonMenuItem lsb;
      private JRadioButtonMenuItem usb;
      private JRadioButtonMenuItem am;
      private JRadioButtonMenuItem sam;
  
      private long frequency;
      private String modeString="";
      
      private DecimalFormat mhzFormat=new DecimalFormat("####0");
      private DecimalFormat khzFormat=new DecimalFormat("000000");
  
  }
  