From 0ec11156c87afc066b1a6ef8f569aedad3a16ae5 Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Tue, 16 May 2023 22:48:41 -0400 Subject: Overhaul of the look of the gui, I need to rename the boxes --- src/fallTest/newSongPlayer.java | 107 +++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 46 deletions(-) (limited to 'src/fallTest/newSongPlayer.java') diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java index d98b235..ff96d63 100644 --- a/src/fallTest/newSongPlayer.java +++ b/src/fallTest/newSongPlayer.java @@ -1,6 +1,10 @@ package fallTest; import javafx.event.EventHandler; + +import java.awt.Insets; + +import javafx.event.*; import javafx.event.ActionEvent; import javafx.geometry.Pos; import javafx.scene.control.Button; @@ -14,36 +18,27 @@ import javafx.scene.layout.BorderWidths; import javafx.scene.layout.CornerRadii; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; +import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; +import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.Text; public class newSongPlayer extends Pane { - - public newSongPlayer() { - /*TButton dButton = new TButton(Color.RED, 50, 50, 5); - System.out.println(super.widthProperty()); - dButton.heightProperty().bind(super.widthProperty().divide(1)); - dButton.widthProperty().bind(super.widthProperty().divide(1)); - - HBox buttonBox = new HBox(); - buttonBox.getChildren().addAll(dButton); - buttonBox.setAlignment(Pos.CENTER); - buttonBox.setSpacing(10); - - super.getChildren().add(buttonBox); - //buttonBox.setBorder(border);*/ - } - public void init() { + Rectangle field = new Rectangle(50, 50, new Color(0, 0, 0, 0.7)); + field.heightProperty().bind(this.getScene().getWindow().heightProperty().multiply(0.95)); + field.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(2.).add(50)); + TButton dButton = new TButton(Color.RED, 50, 50, 5); - dButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - dButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - dButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - dButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - dButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + dButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + dButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + dButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + dButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + dButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); + //Text dButtonText = new Text("D"); dButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.D) { System.out.println("D"); @@ -51,11 +46,11 @@ public class newSongPlayer extends Pane }); TButton fButton = new TButton(Color.BLUE, 50, 50, 5); - fButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - fButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - fButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - fButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - fButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + fButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + fButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + fButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + fButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + fButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); fButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.F) { System.out.println("F"); @@ -63,11 +58,11 @@ public class newSongPlayer extends Pane }); TButton sButton = new TButton(Color.GREEN, 50, 50, 5); - sButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - sButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - sButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - sButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - sButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + sButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + sButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + sButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + sButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + sButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); sButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.SPACE) { System.out.println("SPC"); @@ -75,11 +70,11 @@ public class newSongPlayer extends Pane }); TButton jButton = new TButton(Color.PURPLE, 50, 50, 5); - jButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - jButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - jButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - jButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - jButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + jButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + jButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + jButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + jButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + jButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); jButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.J) { System.out.println("J"); @@ -87,29 +82,49 @@ public class newSongPlayer extends Pane }); TButton kButton = new TButton(Color.YELLOW, 50, 50, 5); - kButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - kButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - kButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - kButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - kButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + kButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + kButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + kButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + kButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + kButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); kButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.K) { System.out.println("K"); } }); + //StackPane dButtonComplete = new StackPane(); + //dButtonComplete.getChildren().addAll(dButtonText, dButton); HBox buttonBox = new HBox(); - buttonBox.setAlignment(Pos.CENTER_LEFT); + + buttonBox.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;" + + "-fx-border-width: 0;" + "-fx-border-insets: 20;" + + "-fx-border-radius: 0;" + "-fx-border-color: black;" + + "-fx-background-color: black;" + "-fx-opacity: 0.67;"); + buttonBox.setAlignment(Pos.CENTER); buttonBox.getChildren().addAll(dButton, fButton, sButton, jButton, kButton); buttonBox.setSpacing(10); - VBox root = new VBox(); - root.setAlignment(Pos.CENTER); - root.getChildren().addAll(buttonBox); - root.setSpacing(10); + VBox polish = new VBox(); + polish.prefHeightProperty().bind(this.getScene().heightProperty()); + polish.getChildren().addAll(field); + polish.setAlignment(Pos.TOP_CENTER); + + VBox place = new VBox(); + place.prefWidthProperty().bind(this.getScene().widthProperty()); + place.prefHeightProperty().bind(this.getScene().heightProperty()); + //root.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;" + // + "-fx-border-width: 2;" + "-fx-border-insets: 0;" + // + "-fx-border-radius: 2;" + "-fx-border-color: red;"); + place.setAlignment(Pos.BOTTOM_CENTER); + place.getChildren().addAll(buttonBox); + place.setSpacing(10); + StackPane root = new StackPane(); + root.getChildren().addAll(polish, place); super.getChildren().add(root); + } } -- cgit v1.2.3