title: Java cannot find method symbol
body: <p>I am trying to access a method from inside the connectEvent method in Controller.java and it gives me the error:</p>
  
  <pre><code>Java: cannot find symbol
  symbol: method getConnection()
  location: variable main of type sample.Main
  </code></pre>
  
  <p>Have I overlooked something?
  I have tried everything
  Cheers</p>
  
  <p>Controller.java</p>
  
  <pre><code>    package sample;
  
  import javafx.beans.NamedArg;
  import javafx.event.ActionEvent;
  import javafx.event.Event;
  import javafx.event.EventType;
  import javafx.fxml.FXML;
  import javafx.scene.control.Button;
  import javafx.scene.control.TextArea;
  import lombok.Getter;
  import lombok.Setter;
  
  public class Controller{
  
      @Getter
      private Main main;
  
      public Controller(Main main){
          this.main = main;
      }
  
      //FXML to Java Links
  
      @FXML
      @Getter
      private Button connectButton;
  
      @FXML
      @Getter
      private TextArea passwordText;
  
      @FXML
      @Getter
      private TextArea ipText;
  
      @FXML
      @Getter
      private TextArea usernameText;
  
  
      //FXML linked methods
  
      /**
       * Called when user tries to connect using supplied information
       */
  
      @FXML
      public void connectEvent(ActionEvent event){
          main.getConnection().connect(getUsernameText().getText(), passwordText.getText(), ipText.getText());
      }
  
  }
  </code></pre>
  
  <p>Main.java</p>
  
  <pre><code>package sample;
  
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  import lombok.Getter;
  
  public class Main extends Application {
  
      @Getter
      private Controller controller;
  
      @Getter
      private Connection connection = new Connection();
  
      @Override
      public void start(Stage primaryStage) throws Exception{
  
          FXMLLoader loader = new FXMLLoader(getClass().getResource("Startup.fxml"));
          controller = loader.getController();
  
          Parent root = loader.load(getClass().getResource("Startup.fxml"));
          primaryStage.setTitle("MCManager");
          primaryStage.setScene(new Scene(root, 850, 600));
          primaryStage.setResizable(false);
          primaryStage.show();
  
      }
  
  
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p>Connection</p>
  
  <pre><code>package sample;
  
  public class Connection {
  
      public void connect(String username, String password, String ip){
  
      }
  
  }
  </code></pre>