Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1. package application;
  2. import java.util.Random;
  3.  
  4. import javafx.event.ActionEvent;
  5. import javafx.fxml.FXML;
  6. import javafx.scene.control.TextArea;
  7. import javafx.scene.control.TextField;
  8.  
  9. public class SampleController {
  10.     Random rand = new Random();
  11.     int result = 1 + rand.nextInt(6);
  12.    
  13.     //Variables
  14.     public int player1Score = 0;
  15.     public int player2Score = 0;
  16.     public int player3Score = 0;
  17.     public int player4Score = 0;
  18.     public int numberOfPlayers = 0;
  19.     public int currentRound = 0;
  20.    
  21.     @FXML
  22.     private TextField txtResult;
  23.    
  24.     @FXML
  25.     private void handleButtonRollAction(ActionEvent event) {
  26.         System.out.print(result);
  27.         txtResult.setText(String.valueOf(result));
  28.     }
  29.     @FXML
  30.     private TextField txtIn;
  31.     @FXML
  32.     private TextArea txtOut;
  33.    
  34.     @FXML
  35.     private void handleRoll(ActionEvent event) {
  36.         for(int i = 0; i < numberOfPlayers; i++) {
  37.            
  38.         }
  39.         currentRound++;
  40.     }
  41.     @FXML
  42.     private void handleConfirmButton(ActionEvent event) {
  43.         if (txtIn.getText() == "2") {
  44.             numberOfPlayers += 2;
  45.         }
  46.         else if (txtIn.getText() == "3") {
  47.             numberOfPlayers += 3;
  48.         }
  49.         else if (txtIn.getText() == "4") {
  50.             numberOfPlayers += 4;
  51.             }
  52.         else {
  53.             System.out.print("Invalid Input");
  54.         }
  55.     }
  56.    
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement