title: Convert Actionlistener type to integer java
body: <p>I need to convert an <code>Actionlistener</code> type to an integer to call a method.
  Any ideas?</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  /**
  * sold by pound
  */
  public class CandyPanel extends JPanel { 
      public CandyPanel () {
          // Create a GridLayout manager with 
          // two rows and one column.
          setLayout(new GridLayout(1, 1));
  
          // Create the radio buttons.
          JPanel gummyBears = new JPanel(new BorderLayout());
  
          // Add a border around the panel.
          setBorder(BorderFactory.createTitledBorder("Gummy Bears"));
  
          // Add the JPanel to the panel.
          add(gummyBears);
      }
  
      /** 
      * returns the total cost of the item based on the 
      * number of units purchased 
      * @param number    the number of units purchased 
      * @return          the total cost of those units 
      */
      public double getCost(int number) { 
           double total = number * 2.00;
           return total;
      } 
  
      /** 
      * Prints the ordered item 
      * @param amount    the number of units purchased 
      * @param cost      the total cost of those units 
      */
      public void printOrderItem(int amount, double cost){ 
          JOptionPane.showMessageDialog(null, amount + " Gummy Bears at $2.00/pound = $" + cost + ".");
      } 
  }
  </code></pre>
  
  <p>This is the method which will require the converted <code>int</code>.</p>
  
  <pre><code>public double getCost(int number) { 
       double total = number * 2.00;
       return total;
  } 
  </code></pre>
  
  <p>I tried doing <code>parseInt</code> as researched online but it does not work with <code>ActionEvent</code>.</p>