title: Printing method into textfield
body: <p>How do I print a method into a textfield in JavaFX, the methods output is a Integer?</p>
  
  <p>I have this class, which makes a dice, and i want to print the number into a textfield.</p>
  
  <pre><code>import java.util.Random;
  
  
  public class Dice {
  
  public Die Die1 = new Die(6);
  public Die Die2 = new Die(6);
  
  
  public int throwDice(){
      Die1.throwDie();
      Die2.throwDie();
      return(Die1.diceEyes+Die2.diceEyes);
  }
  
  public void isItaPair(){
      if(Die1.diceEyes==Die2.diceEyes)
          System.out.println("Its a pair, throw again.");
      throwDice();
  }
  
  class Die {
  
  private final int diceSides;
  public int diceEyes;
  private Random randomEyes = new Random();
  
  public Die(int diceSides){
      this.diceSides = diceSides;
  
  }
  
  
  public void throwDie(){
      diceEyes = randomEyes.nextInt(diceSides)+1;
  }
  }
  }
  </code></pre>
  
  <p>This is my JavaFX controller class, i want to print the outcome of Die1.throwDice() into the textfield dice_field.</p>
  
  <pre><code>import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.Button;
  import javafx.scene.control.Label;
  import javafx.scene.control.TextArea;
  import javafx.scene.control.TextField;
  import moole15gop_1.Dice;
  import moole15gop_1.Player;
  
  public class FXMLDocumentController implements Initializable {
  
  
  
  
  @FXML
  private TextField user1;
  @FXML
  private TextField user2;
  @FXML
  private TextArea game_text1;
  @FXML
  private TextArea game_text2;
  @FXML
  private Button start_btn1;
  @FXML
  private Button start_btn2;
  @FXML
  private Button game_btn;
  @FXML
  private Label game_label;
  @FXML
  private TextField dice_field;
  
  @Override
  public void initialize(URL url, ResourceBundle rb) {
  
  }
  
  @FXML
  private void start_action1(ActionEvent event) {
      user1.setText(user1.getText());
      System.out.println(user1.getText());
      if(user1.getText().isEmpty()){
          game_label.setText("You need to enter a username for the first     player!");             
      }
      else
      {
      game_text1.setText("Your username is " + user1.getText() + " and you have " + Player.playerMoney + ". You start at position " + Player.position);
      }
  
  }
  
  @FXML
  private void start_action2(ActionEvent event) {
      user2.setText(user2.getText());
      System.out.println(user2.getText());
      if(user2.getText().isEmpty()){
          game_label.setText("You need to enter a username for the second player!");             
      }
      else
      {
      game_text2.setText("Your username is " + user2.getText() + " and you have " + Player.playerMoney + ". You start at position " + Player.position);
      }
  }
  
  Dice die1 = new Dice();
  
  @FXML
  private void game_action(ActionEvent event) {
  
  }
  
  
  }
  </code></pre>
  
  <p>The method should be printed when the game_action event is activated.</p>
  
  <p>Thanks for the help in advance.</p>