diff --git a/soccer-ball.png b/soccer-ball.png new file mode 100644 index 0000000..4a0d229 Binary files /dev/null and b/soccer-ball.png differ diff --git a/src/wrestlingtournamentcli/Main.java b/src/wrestlingtournamentcli/Main.java index 53e5234..92cfaa9 100644 --- a/src/wrestlingtournamentcli/Main.java +++ b/src/wrestlingtournamentcli/Main.java @@ -19,12 +19,17 @@ import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.scene.layout.Background; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.stage.FileChooser; import javafx.stage.Stage; import javafx.scene.control.Tooltip; +import javafx.scene.image.Image ; +import javafx.scene.image.ImageView; + /** * @author Jared Murphy * @author Cody Francis @@ -440,7 +445,6 @@ public void start(Stage stage) throws Exception { BorderPane root = new BorderPane(); VBox mainMenu = new VBox(); VBox viewList = new VBox(); - Button add = new Button(); Button viewTeams = new Button(); Button viewWrestlers = new Button(); Button importTeams = new Button(); @@ -450,26 +454,22 @@ public void start(Stage stage) throws Exception { Button compareWrestlers = new Button(); - TextField compareWrestlersTxt = new TextField(); + TextField compareWrestlersTxt = new TextField(); TextField saveTournament = new TextField(); - TextField FirstName = new TextField(); - TextField LastName = new TextField(); - TextField TeamAlias = new TextField(); - TextField Grade = new TextField(); - TextField Weight = new TextField(); - TextField TotalWins = new TextField(); - TextField TotalMatch = new TextField(); compareWrestlers.setMinWidth(110); compareWrestlersTxt.setMinWidth(110); compareWrestlers.setText("Compare Wrestlers"); compareWrestlersTxt.setText("Name,Name"); ListView compareWrestlerView = new ListView(); - Button wrestlerBack = new Button(); + Button wrestlerBack = new Button(); ListView startView = new ListView(); //button declarations i've added Button advance = new Button(); Button help = new Button(); Button update = new Button(); + + + // adds tooltips to each menu button Tooltip viewTeamsTooltip = new Tooltip("Displays the imported teams in the display box to the right"); Tooltip.install(viewTeams, viewTeamsTooltip); @@ -483,21 +483,27 @@ public void start(Stage stage) throws Exception { Tooltip.install(start, startToolTip); Tooltip saveTooltip = new Tooltip("Saves the results of the matches to a file(Use text box to save the name of the tournament)"); Tooltip.install(save, saveTooltip); + ListView listView = new ListView(); ListView wrestlerView = new ListView(); + ListView helpView = new ListView(); + TextField importWrestlerField = new TextField (); + Label menu = new Label("Main Menu"); - menu.setStyle("-fx-font-weight: bold; -fx-font: 24 arial"); + menu.setStyle("-fx-font-weight: bold; -fx-font: 24 arial;-fx-text-fill: Yellow"); + // create buttons/textfields for view of team and wrestlers - add.setMinWidth(110); - add.setText("Add Wrestler"); + BorderPane introRoot= new BorderPane(); GridPane introLayout = new GridPane(); Button wrestling = new Button(); Button soccer = new Button(); Label introMenu = new Label("Please select the sport you would like to manage:"); //UI elements for selection Screen + introMenu.setStyle("-fx-font: 16 arial;-fx-text-fill: Yellow"); + BorderPane soccerRoot = new BorderPane(); Label soccerLabel = new Label("Soccer Menu"); VBox soccerMenu = new VBox(); @@ -538,12 +544,27 @@ public void start(Stage stage) throws Exception { wrestling.setPadding(new Insets(10,10,10,10)); soccer.setText("Soccer"); soccer.setPadding(new Insets(10,10,10,10)); - introLayout.setPadding(new Insets(300,100,100,100)); - introLayout.add(introMenu, 0, 0); - introLayout.add(wrestling, 2,3 ); - introLayout.add(soccer, 3, 3); + introLayout.setPadding(new Insets(50,100,100,100)); + introLayout.add(introMenu, 1, 1); + introLayout.add(wrestling, 1,2 ); + introLayout.add(soccer, 1, 3); + introLayout.setStyle("-fx-background-color: Green"); + //Image image = new Image("RaiderSMA/icon.png"); + //Image soccerBall = new Image("file:soccer-ball.png"); + //introLayout.getChildren().add(new ImageView(soccerBall)); + + //adds the soccer png to the intro screen + ImageView imv = new ImageView(); + Image image = new Image("file:soccer-ball.png"); + imv.setImage(image); + final HBox soccerPictureRegion = new HBox(); + soccerPictureRegion.getChildren().add(imv); + introLayout.add(soccerPictureRegion, 10, 10); + introRoot.setCenter(introLayout); + //Initializing introduction UI elements + importTeams.setMinWidth(110); importWrestlers.setMinWidth(110); viewTeams.setMinWidth(110); @@ -551,34 +572,28 @@ public void start(Stage stage) throws Exception { saveTournament.setMinWidth(110); save.setMinWidth(110); start.setMinWidth(110); - FirstName.setMinWidth(110); - LastName.setMinWidth(110); + update.setMinWidth(110); help.setMinWidth(110); advance.setMinWidth(110); advance.setText("Advance"); help.setText("Help"); update.setText("Update Match"); + save.setText("Save"); start.setText("Start"); - FirstName.setPromptText("First Name"); - LastName.setPromptText("Last Name"); - TeamAlias.setPromptText("Team Alias"); - Grade.setPromptText("Grade"); - Weight.setPromptText("Player's Weight"); - TotalWins.setPromptText("Total Wins"); - TotalMatch.setPromptText("Total Match"); + importTeams.setText("Import Teams"); importWrestlers.setText("Import Wrestlers"); viewTeams.setText("View Teams"); viewWrestlers.setText("View Wrestlers"); - saveTournament.setPromptText("Name of Tournament"); saveTournament.setText("Name of Tournament"); wrestlerBack.setText("Back"); //create the layout of the menu GridPane layout = new GridPane(); + layout.setStyle("-fx-background-color: Green"); layout.setPadding(new Insets(10,10,10,10)); - layout.setMinSize(300, 300); + layout.setMinSize(300, 700); layout.setVgap(5); layout.setHgap(5); layout.setAlignment(Pos.BASELINE_LEFT); @@ -589,45 +604,52 @@ public void start(Stage stage) throws Exception { layout.add(viewWrestlers, 0, 2); layout.add(save, 0, 5); layout.add(saveTournament, 1, 5); - layout.add(start, 0, 13); - layout.add(add, 0, 6); - layout.add(FirstName, 1, 6); - layout.add(LastName, 1, 7); - layout.add(TeamAlias, 1, 8); - layout.add(Grade, 1, 9); - layout.add(Weight, 1, 10); - layout.add(TotalWins, 1,11); - layout.add(TotalMatch, 1, 12); layout.add(start, 0, 6); + layout.add(compareWrestlers, 0, 7); - layout.add( compareWrestlersTxt, 1, 7); + layout.add(compareWrestlersTxt, 1, 7); + + + layout.add(advance, 0, 9); layout.add(help, 0, 10); layout.add(update, 0, 11); + Scene introScene = new Scene (introRoot, 700, 700); Scene wrestlerScene = new Scene(root,700,700); Scene soccerScene = new Scene(soccerRoot,700,700); wrestling.setOnAction(e ->{ + Model m = new Model("wrestling"); - stage.setScene(wrestlerScene); + stage.setScene(wrestlerScene); + }); - soccer.setOnAction(e ->{ + soccer.setOnAction(e ->{ + Model soccerModel = new Model("soccer"); stage.setScene(soccerScene); + }); + + + viewTeams.setOnAction(e -> { + ArrayList show = Model.printTeams(); - for(int i = 0; i < show.size(); i++) { + for(int i = 0; i < show.size(); i++) { listView.getItems().add(show.get(i)); - } - return; + } + + return; }); soccerBack.setOnAction(e -> { + stage.setScene(introScene); + }); wrestlerBack.setOnAction(e->{ @@ -991,32 +1013,7 @@ else if (check == 2) { stage2.show(); }); - add.setOnAction(e-> { - if(FirstName.getText().isEmpty() && LastName.getText().isEmpty() - && TeamAlias.getText().isEmpty() && Grade.getText().isEmpty() && Weight.getText().isEmpty() && - TotalWins.getText().isEmpty() && TotalMatch.getText().isEmpty()) { - Alert FirstNameEmpty = new Alert(AlertType.ERROR); - FirstNameEmpty.setTitle("New Player Alert"); - String FirstNameEmptyInfo = "Please enter Information \n"; - FirstNameEmpty.setContentText(FirstNameEmptyInfo); - FirstNameEmpty.show(); - } - else { - try { - String FN = FirstName.getText(); - String LN = LastName.getText(); - String TA = TeamAlias.getText(); - int grade = Integer.parseInt(Grade.getText()); - int weight = Integer.parseInt(Weight.getText()); - int totalWins = Integer.parseInt(TotalWins.getText()); - int totalMatch = Integer.parseInt(TotalMatch.getText()); - new Wrestler(FN, LN,TA, grade, weight, totalWins, totalMatch); - } - catch(Exception a) { - System.out.println("Something went wrong"); - } - } - }); + mainMenu.getChildren().addAll(layout); viewList.prefWidth(100); viewList.getChildren().addAll(listView, wrestlerView, compareWrestlerView,startView,helpView); @@ -1028,5 +1025,6 @@ else if (check == 2) { stage.setScene(introScene); stage.show(); + } }