Advertisement
Luninariel

textGame - Main

Dec 11th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. package sample;
  2.  
  3. import javafx.application.Application;
  4. import javafx.scene.control.*;
  5. import javafx.scene.layout.GridPane;
  6. import javafx.scene.Scene;
  7. import javafx.stage.Stage;
  8. import sample.edu.missouriwestern.cpozo.monsters.*;
  9.  
  10. import java.util.ArrayList;
  11.  
  12. public class Main extends Application {
  13.  
  14. public static Label player1 = new Label("First Combatant");
  15. public static Label player2 = new Label("Second Combatant");
  16. public static RadioButton warrior1 = new RadioButton("Warrior");
  17. public static RadioButton warrior2 = new RadioButton("Warrior");
  18. public static RadioButton Human1 = new RadioButton("Human");
  19. public static RadioButton Human2 = new RadioButton("Human");
  20. public static RadioButton ninja1 = new RadioButton("Ninja");
  21. public static RadioButton ninja2 = new RadioButton("Ninja");
  22. public static RadioButton Rabbit1 = new RadioButton("Rabbit");
  23. public static RadioButton Rabbit2 = new RadioButton("Rabbit");
  24.  
  25. public static Button Play = new Button("Fight!");
  26. public static Button Reset = new Button("Start a new fight");
  27. public static TextArea playbyplaybox = new TextArea("");
  28. public static Label CombatantA = new Label("Combatant A");
  29. public static TextField textFieldA = new TextField();
  30. public static Label CombatantB = new Label("Combatant B");
  31. public static TextField textFieldB = new TextField();
  32.  
  33.  
  34. @Override
  35. public void start(Stage primaryStage) throws Exception {
  36. GridPane root = new GridPane();
  37. root.setHgap(5.0);
  38. root.setVgap(10.0);
  39.  
  40. root.add(player1, 3, 1);
  41. root.add(player2, 4, 1);
  42. root.add(warrior1, 3, 2);
  43. root.add(warrior2, 4, 2);
  44. root.add(Human1, 3, 3);
  45. root.add(Human2, 4, 3);
  46. root.add(ninja1, 3, 4);
  47. root.add(ninja2, 4, 4);
  48. root.add(Rabbit1, 3, 5);
  49. root.add(Rabbit2, 4, 5);
  50.  
  51.  
  52. root.add(Play, 3, 20);
  53. root.add(Reset, 4, 20);
  54. root.add(CombatantA, 3, 7);
  55. root.add(textFieldA, 4, 7);
  56. root.add(CombatantB, 3, 8);
  57. root.add(textFieldB, 4, 8);
  58. root.add(playbyplaybox, 3, 10, 2, 5);
  59.  
  60.  
  61. primaryStage.setTitle("Monster Game");
  62. primaryStage.setScene(new Scene(root, 600, 600));
  63. primaryStage.show();
  64. }
  65.  
  66. public static void main(String[] args) {
  67. launch(args);
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement