I have a problem with connect. I can't connect between client in Start and client in Login. When I run app, It is NullPointerException. Why is connect between client in Start and client in Login?
public class LoginWindow extends Application{
    Client client = new Client("localhost", 3333);
    @FXML
    private TextField Username;
    @FXML
    private PasswordField Password;
    @FXML
    private Button login;
    public void Login(ActionEvent event) throws IOException {
        Stage stage;
        Parent root;
        //client.connect();
        String username = Username.getText();
        String password = Password.getText();
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        //if (username.equals("user") && password.equals("pass")){
        if (client.Check_Login(username, password)) {
            stage = (Stage) login.getScene().getWindow();
            root = FXMLLoader.load(getClass().getResource("ChatView.fxml"));
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        } else {
            alert.setContentText("Login failed");
            alert.show();
        }
    }
   @Override
    public void start(Stage primaryStage) throws Exception {
        client.connect();
        Parent root = FXMLLoader.load(LoginWindow.class.getResource("LoginWindow.fxml"));
        primaryStage.setTitle("Chat 419");
        primaryStage.setScene(new Scene(root, 600, 400));
        primaryStage.show();
    }
}
