title: How to use ActionListener when the button function is in another class
body: <p>I have three different classes: Main, WindowFrameDimetnions, and ValidationOfNumbers. 
  Main – Calls WindowFrameDimetnions. It is the main class
  WindowFrameDimetnions – Calls (well I am trying to call ) ValidationOfNumbers. This is the class that creates the frame for the program, the pane, the label for the box, and the button. 
  ValidationOfNumbers – is the one that does all the calculations for number validations. Basically this class validates that the numbers typed by the use are within the range of 1..100,000.</p>
  
  <p>Goal:
  The goal is to connect WindowFrameDimetnions with ValidationOfNumbers by using an ActionListener.</p>
  
  <pre><code>package BlueBlueMainFiles;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  import javax.swing.JTextField;
  
  public class WindowFrameDimentions extends JFrame{
  
      final static int WINDOW_WITH    = 950;//Window with in pixel
      final static int WINDOW_HEIGH   = 650;//Window height in pixel
      static JPanel       panel;//use to reference the panel
      static JLabel       messageLabel;//use to reference the label 
      static JTextField   textField;//use to reference the text field
      static JButton      calcButton;//use to reference the button 
  
      public WindowFrameDimentions() {
          // TODO Auto-generated constructor stub
      }
  
      public static void windowFrameDimentions(){
          //create a new window
          JFrame window = new JFrame();
  
          //add a name to the window
          window.setTitle("BLUE BLUE");
  
          //set the size of the window
          window.setSize(WINDOW_WITH, WINDOW_HEIGH);
  
          //specify what happens when the close button is pressed 
          window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          //BUILD THE PANEL AND ADD IT TO THE FRAME
          buildPanel();
  
          //ADD THE PANEL TO THE FRAMES CONTENT PANE
          window.add(panel);
  
          //Display the window
          window.setVisible(true);
      }
  
      public static void buildPanel(){
          //create a label to display instructions
          messageLabel = new JLabel("Enter a Number from 1..100,000");
  
          //create a text field of 10 characters wide
          textField = new JTextField(10);
  
          //create panel
          calcButton = new JButton("Calculate");
  
  
          //Add an action listening to the button. Currently, I can't make it work
  
  
          //Create the a JPanel object and let the panel field reference it
          panel = new JPanel();
  
          panel.add(messageLabel);
          panel.add(textField);
          panel.add(calcButton);
  
      }
  }
  </code></pre>
  
  <p>Now this is the other code:</p>
  
  <pre><code>package TheValidationFiles;
  
  
  public class  ValidationOfNumbers {
  
      static int MAX_NUMBER_TO_VAL = 10000000;
  
      public static void GetValidationOfNumbers(boolean isTrue, String s) {
  
               String[] numberArray = new String [MAX_NUMBER_TO_VAL];
               boolean numberMatching = false;
  
               for (int i = 0; i &lt; MAX_NUMBER_TO_VAL; i++){
                       numberArray[i] = Integer.toString(i);
  
                       if (numberArray[i].equals(s)){
                           System.out.println("The number you typed " + s + " Matches with the array value of: " + numberArray[i]);
                           System.exit(0);
                           break;
                       }
                       else{
                           numberMatching = true;
                       }
               }
               if(numberMatching){
                   ValidationOfFiles.ValidationOfFiles(s);
               }
      }
  
  }
  </code></pre>