From 06ec2dae12d8e9de7b2a45cdb499e32dd92702a7 Mon Sep 17 00:00:00 2001 From: walkerp07 Date: Wed, 12 Jun 2024 20:41:59 -0400 Subject: [PATCH] Allow for word wrapping on "Accepted taker countries" field --- .../overlays/windows/OfferDetailsWindow.java | 2 +- .../java/haveno/desktop/util/FormBuilder.java | 30 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java index f7e12cf2476..0692162eb4d 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/OfferDetailsWindow.java @@ -301,7 +301,7 @@ private void addContent() { tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes)); } } - Label acceptedCountries = addConfirmationLabelLabel(gridPane, ++rowIndex, + Label acceptedCountries = addConfirmationLabelLabel(gridPane, true, ++rowIndex, Res.get("shared.acceptedTakerCountries"), countries).second; if (tooltip != null) { acceptedCountries.setMouseTransparent(false); diff --git a/desktop/src/main/java/haveno/desktop/util/FormBuilder.java b/desktop/src/main/java/haveno/desktop/util/FormBuilder.java index 57c09c2f134..437dd3b5806 100644 --- a/desktop/src/main/java/haveno/desktop/util/FormBuilder.java +++ b/desktop/src/main/java/haveno/desktop/util/FormBuilder.java @@ -379,15 +379,30 @@ public static Tuple2 addTextFieldWithEditButton(GridPane grid /////////////////////////////////////////////////////////////////////////////////////////// // Confirmation Fields /////////////////////////////////////////////////////////////////////////////////////////// + public static Tuple2 addConfirmationLabelLabel(GridPane gridPane, + int rowIndex, + String title1, + String title2, + double top) { + return addConfirmationLabelLabel(gridPane, false, rowIndex, title1, title2, top); + } + public static Tuple2 addConfirmationLabelLabel(GridPane gridPane, + int rowIndex, + String title1, + String title2) { + return addConfirmationLabelLabel(gridPane, false, rowIndex, title1, title2, 0); + } public static Tuple2 addConfirmationLabelLabel(GridPane gridPane, + boolean isWrapped, int rowIndex, String title1, String title2) { - return addConfirmationLabelLabel(gridPane, rowIndex, title1, title2, 0); + return addConfirmationLabelLabel(gridPane, isWrapped, rowIndex, title1, title2, 0); } public static Tuple2 addConfirmationLabelLabel(GridPane gridPane, + boolean isWrapped, int rowIndex, String title1, String title2, @@ -396,6 +411,7 @@ public static Tuple2 addConfirmationLabelLabel(GridPane gridPane, label1.getStyleClass().add("confirmation-label"); Label label2 = addLabel(gridPane, rowIndex, title2); label2.getStyleClass().add("confirmation-value"); + label2.setWrapText(isWrapped); GridPane.setColumnIndex(label2, 1); GridPane.setMargin(label1, new Insets(top, 0, 0, 0)); GridPane.setHalignment(label1, HPos.LEFT); @@ -451,12 +467,21 @@ public static Tuple2 addConfirmationLabelTextArea(GridPane grid String title1, String title2, double top) { + return addConfirmationLabelTextArea(gridPane, false, rowIndex, title1, title2, top); + } + + public static Tuple2 addConfirmationLabelTextArea(GridPane gridPane, + boolean isWrapped, + int rowIndex, + String title1, + String title2, + double top) { Label label = addLabel(gridPane, rowIndex, title1); label.getStyleClass().add("confirmation-label"); TextArea textArea = addTextArea(gridPane, rowIndex, title2); ((JFXTextArea) textArea).setLabelFloat(false); - + textArea.setWrapText(isWrapped); GridPane.setColumnIndex(textArea, 1); GridPane.setMargin(label, new Insets(top, 0, 0, 0)); GridPane.setHalignment(label, HPos.LEFT); @@ -466,6 +491,7 @@ public static Tuple2 addConfirmationLabelTextArea(GridPane grid } + /////////////////////////////////////////////////////////////////////////////////////////// // Label + TextFieldWithIcon ///////////////////////////////////////////////////////////////////////////////////////////