title: Javafx - how to acces FXML "objects"
body: <p>I have some JavaFX components declared in my fxml file.</p>
  
  <p><a href="https://i.stack.imgur.com/S6F50.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S6F50.png" alt="The Frame"></a></p>
  
  <p>and how do I get the values of the fields (Username, Password) when the button is pressed? (To perform the login).</p>
  
  <pre><code>  Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
    stage.setTitle("Login");
    stage.setScene(new Scene(root,400,300));
    stage.show();
  </code></pre>
  
  <p>or is this the complete wrong way to do it?</p>
  
  <p>My Questions:</p>
  
  <ol>
  <li>Is it a good idea to declare all fields in the fxml file?</li>
  <li>How do I get the objects to acces the Values?</li>
  <li>If its the complete wrong way, how can it be done? (I want to use scenebuilder)</li>
  </ol>
  
  <p>EDIT : 
  <a href="https://hastebin.com/qexipogoma.xml" rel="nofollow noreferrer">https://hastebin.com/qexipogoma.xml</a> &lt;- My FXML fie and my controller</p>