diff options
-rwxr-xr-x | README.md | 10 | ||||
-rw-r--r-- | src/main/java/net/sowgro/npehero/main/ErrorDisplay.java | 16 | ||||
-rw-r--r-- | src/main/java/net/sowgro/npehero/main/ValidIndicator.java | 11 |
3 files changed, 23 insertions, 14 deletions
@@ -11,14 +11,16 @@ Goals: Todo - needs design: - Improve errorList and error handling -- tweak game end -- make noteseditor2 resizeable +- tweak game end screen +- Improve aesthetic of songplayer +- overhaul noteseditor2 +- improve songplayer and noteseditor2 resizing Todo - bugs: -- fix noteseditor1 +- - fix reliance on local font -- Fix notesEditor note preview being too small with no notes - Properly center background image +- fix or remove noteseditor1 # Building ### Run the app diff --git a/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java b/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java index 32f7a63..d6eea26 100644 --- a/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java +++ b/src/main/java/net/sowgro/npehero/main/ErrorDisplay.java @@ -4,6 +4,7 @@ import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.Label; +import javafx.scene.control.ToggleButton; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; @@ -14,7 +15,7 @@ import java.io.StringWriter; public class ErrorDisplay extends Page { - private HBox content = new HBox(); + private final HBox content = new HBox(); /** * Error display with a message and Back button @@ -51,7 +52,6 @@ public class ErrorDisplay extends Page { */ public ErrorDisplay(String message, Exception e, Page prev) { Label title = new Label(message); - title.setPadding(new Insets(10)); title.setWrapText(true); Label exView = new Label(e.toString()); @@ -63,7 +63,7 @@ public class ErrorDisplay extends Page { String sStackTrace = sw.toString(); // stack trace as a string Label stackTrace = new Label(sStackTrace); - stackTrace.getStyleClass().add("red"); + stackTrace.getStyleClass().addAll("red", "box"); stackTrace.setVisible(false); stackTrace.setManaged(false); @@ -80,17 +80,17 @@ public class ErrorDisplay extends Page { e.printStackTrace(); }); - Button showStack = new Button("Show Stack Trace"); - showStack.setOnAction(_ -> { - stackTrace.setVisible(true); - stackTrace.setManaged(true); - }); + ToggleButton showStack = new ToggleButton("Show Stack Trace"); + stackTrace.managedProperty().bind(showStack.selectedProperty()); + stackTrace.visibleProperty().bind(showStack.selectedProperty()); HBox buttonBox = new HBox(exit, showStack, printStack); buttonBox.setSpacing(10); VBox main = new VBox(title, exView, stackTrace); main.getStyleClass().add("box"); + main.setPadding(new Insets(10)); + main.setSpacing(10); VBox centerBox = new VBox(); centerBox.getChildren().addAll(main, buttonBox); diff --git a/src/main/java/net/sowgro/npehero/main/ValidIndicator.java b/src/main/java/net/sowgro/npehero/main/ValidIndicator.java index f2b38d2..9e1376f 100644 --- a/src/main/java/net/sowgro/npehero/main/ValidIndicator.java +++ b/src/main/java/net/sowgro/npehero/main/ValidIndicator.java @@ -13,6 +13,10 @@ import java.nio.file.Files; import java.nio.file.Paths; public class ValidIndicator extends Region { + + + private final Tooltip diffLabelTooltip = new Tooltip(); + public ValidIndicator() { this.setScaleX(0.7); this.setScaleY(0.7); @@ -22,15 +26,18 @@ public class ValidIndicator extends Region { public void setValid() { this.setShape(null); this.setBackground(Background.EMPTY); + + Tooltip.uninstall(this, diffLabelTooltip); } public void setInvalid(String reason) { - Tooltip diffLabelTooltip = new Tooltip(reason); - diffLabelTooltip.setShowDelay(Duration.ZERO); SVGPath diffLabelIcon = new SVGPath(); diffLabelIcon.setContent(pathFromSvg(Driver.getResource("error.svg"))); this.setShape(diffLabelIcon); this.setBackground(Background.fill(Color.RED)); + + diffLabelTooltip.setText(reason); + diffLabelTooltip.setShowDelay(Duration.ZERO); Tooltip.install(this, diffLabelTooltip); } |