title: How do I read the information of a JTextField from a separate class using an ActionListener
body: <p>The following code is within a class that has the buttons and checkboxes defined. The problem that I am having is with the lines "String text = txtField.getText();" and "chkAccount.withdraw(amount);".</p>
  
  <p>I have a separate class file that defines the txtField and am trying to get the text that has been input into that box. The error I see is "cannot find symbol". I have looked into it but cant find information in depth enough to answer my question.</p>
  
  <p>The second line refers to the object chkAccount which is derived from a separate class "Account" and instantiated in the main class of my program. The error for this is the same as the above.</p>
  
  <pre><code>//Button Listeners Class
      withdrawalBtn.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
              //Execute this code when the button is pressed
              if(checking.isSelected()) {
                  String text = txtField.getText();
                  int amount = Integer.parseInt(text);
                  try {
                      chkAccount.withdraw(amount);
                  } catch (InsufficientFunds ex) {
                      int messageType = JOptionPane.PLAIN_MESSAGE;
                      JOptionPane.showMessageDialog(null, "Balance too low" +
                              "or amount entered not an Interval of 20.", 
                              "Notice", messageType);
                  }
                  }
  </code></pre>