From 1ad4a679be745635b246689ed75054258023556a Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 26 Mar 2018 12:02:31 +0200 Subject: [PATCH 1/6] Add new version of icon library to enable step-by-step migration --- build.gradle | 4 ++++ src/main/java/bisq/desktop/util/GUIUtil.java | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/build.gradle b/build.gradle index f4351698eff..7e2223ef345 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ repositories { jcenter() maven { url 'https://jitpack.io' } maven { url 'https://raw.githubusercontent.com/JesusMcCloud/tor-binary/master/release/' } + maven { url 'https://dl.bintray.com/jerady/maven' } } dependencies { @@ -40,6 +41,9 @@ dependencies { compile 'org.reactfx:reactfx:2.0-M3' compile 'net.glxn:qrgen:1.3' compile 'de.jensd:fontawesomefx:8.0.0' + compile 'de.jensd:fontawesomefx-commons:8.15' + compile 'de.jensd:fontawesomefx-controls:8.15' + compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4' compile 'com.googlecode.jcsv:jcsv:1.4.0' compileOnly 'org.projectlombok:lombok:1.16.16' annotationProcessor 'org.projectlombok:lombok:1.16.16' diff --git a/src/main/java/bisq/desktop/util/GUIUtil.java b/src/main/java/bisq/desktop/util/GUIUtil.java index 0c8271c01fc..aecfc8010c7 100644 --- a/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/src/main/java/bisq/desktop/util/GUIUtil.java @@ -65,12 +65,15 @@ import javafx.scene.Node; import javafx.scene.Scene; +import javafx.scene.control.ContentDisplay; +import javafx.scene.control.Label; import javafx.scene.control.ScrollBar; import javafx.scene.control.TextArea; import javafx.scene.control.Tooltip; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; import javafx.scene.layout.Region; +import javafx.scene.text.Text; import javafx.geometry.Orientation; @@ -98,6 +101,9 @@ import lombok.extern.slf4j.Slf4j; +import de.jensd.fx.glyphs.GlyphIcons; +import de.jensd.fx.glyphs.materialdesignicons.utils.MaterialDesignIconFactory; + @Slf4j public class GUIUtil { public final static String SHOW_ALL_FLAG = "SHOW_ALL_FLAG"; @@ -543,4 +549,12 @@ public static void removeChildrenFromGridPaneRows(GridPane gridPane, int start, childByRowMap.get(i).forEach(child -> gridPane.getChildren().remove(child)); } } + + public static Text addMaterialDesignIcon(GlyphIcons icon, Label label) { + final Text textIcon = MaterialDesignIconFactory.get().createIcon(icon); + textIcon.setOpacity(0.7); + label.setContentDisplay(ContentDisplay.LEFT); + label.setGraphic(textIcon); + return textIcon; + } } From 626cf5fb1b92c8544c350ef387f1d8fa5b43ae4f Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 26 Mar 2018 14:08:38 +0200 Subject: [PATCH 2/6] Remove unused library --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7e2223ef345..9c93eb377f8 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,6 @@ dependencies { compile 'net.glxn:qrgen:1.3' compile 'de.jensd:fontawesomefx:8.0.0' compile 'de.jensd:fontawesomefx-commons:8.15' - compile 'de.jensd:fontawesomefx-controls:8.15' compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4' compile 'com.googlecode.jcsv:jcsv:1.4.0' compileOnly 'org.projectlombok:lombok:1.16.16' From 4a60865b6b77bcf12fece3a38984838eaf2714f3 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 26 Mar 2018 14:09:21 +0200 Subject: [PATCH 3/6] Use relative font size --- src/main/java/bisq/desktop/bisq.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/bisq/desktop/bisq.css b/src/main/java/bisq/desktop/bisq.css index 977a25d1fff..9372a938339 100644 --- a/src/main/java/bisq/desktop/bisq.css +++ b/src/main/java/bisq/desktop/bisq.css @@ -205,7 +205,7 @@ bg color of non edit textFields: fafafa } .default-text { - -fx-font-size: 13; + -fx-font-size: 1em; } /* Splash */ From 23d0ca990b079946738b8a20a19e435165780201 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 26 Mar 2018 14:10:52 +0200 Subject: [PATCH 4/6] Add new material design icons for offer type (Fixed | Percentage) --- .../offer/createoffer/CreateOfferView.java | 10 +++++++ .../java/bisq/desktop/util/FormBuilder.java | 28 +++++++++++++++++++ src/main/java/bisq/desktop/util/GUIUtil.java | 14 ---------- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java b/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java index 5d52cf77f5e..bb61159e36c 100644 --- a/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java +++ b/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java @@ -126,6 +126,10 @@ import static bisq.desktop.util.FormBuilder.*; import static javafx.beans.binding.Bindings.createStringBinding; + + +import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; + @FxmlView public class CreateOfferView extends ActivatableViewAndModel { @@ -1086,6 +1090,9 @@ private void addAmountPriceFields() { Res.get("shared.distanceInPercent")); percentagePriceDescription = priceAsPercentageInputBoxTuple.first; percentagePriceDescription.setPrefWidth(200); + + getSmallIcon(MaterialDesignIcon.CHART_LINE, percentagePriceDescription); + percentagePriceBox = priceAsPercentageInputBoxTuple.second; // Fixed/Percentage toggle @@ -1194,6 +1201,9 @@ private void addSecondRow() { editOfferElements.add(priceCurrencyLabel); Tuple2 priceInputBoxTuple = getTradeInputBox(priceValueCurrencyBox, ""); priceDescriptionLabel = priceInputBoxTuple.first; + + getSmallIcon(MaterialDesignIcon.LOCK, priceDescriptionLabel); + editOfferElements.add(priceDescriptionLabel); fixedPriceBox = priceInputBoxTuple.second; diff --git a/src/main/java/bisq/desktop/util/FormBuilder.java b/src/main/java/bisq/desktop/util/FormBuilder.java index 9ffde20a854..5b72f120155 100644 --- a/src/main/java/bisq/desktop/util/FormBuilder.java +++ b/src/main/java/bisq/desktop/util/FormBuilder.java @@ -47,6 +47,7 @@ import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; +import javafx.scene.control.ContentDisplay; import javafx.scene.control.DatePicker; import javafx.scene.control.Label; import javafx.scene.control.ListView; @@ -61,6 +62,7 @@ import javafx.scene.layout.Pane; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; +import javafx.scene.text.Text; import javafx.geometry.HPos; import javafx.geometry.Insets; @@ -73,6 +75,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; + + +import de.jensd.fx.glyphs.GlyphIcons; +import de.jensd.fx.glyphs.materialdesignicons.utils.MaterialDesignIconFactory; + public class FormBuilder { private static final Logger log = LoggerFactory.getLogger(FormBuilder.class); @@ -1180,4 +1187,25 @@ public static void removeRowsFromGridPane(GridPane gridPane, int fromGridRow, in .filter(e -> GridPane.getRowIndex(e) >= fromGridRow && GridPane.getRowIndex(e) <= toGridRow) .forEach(e -> gridPane.getChildren().remove(e)); } + + /////////////////////////////////////////////////////////////////////////////////////////// + // Icons + /////////////////////////////////////////////////////////////////////////////////////////// + + public static Text getIcon(GlyphIcons icon, String iconSize, Label label) { + if (icon.fontFamily().equals("'Material Design Icons'")) { + final Text textIcon = MaterialDesignIconFactory.get().createIcon(icon, iconSize); + textIcon.setOpacity(0.7); + label.setContentDisplay(ContentDisplay.LEFT); + label.setGraphic(textIcon); + return textIcon; + } else { + throw new IllegalArgumentException("Not supported icon type"); + } + } + + public static Text getSmallIcon(GlyphIcons icon, Label label) { + return getIcon(icon, "0.769em", label); + } + } diff --git a/src/main/java/bisq/desktop/util/GUIUtil.java b/src/main/java/bisq/desktop/util/GUIUtil.java index aecfc8010c7..0c8271c01fc 100644 --- a/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/src/main/java/bisq/desktop/util/GUIUtil.java @@ -65,15 +65,12 @@ import javafx.scene.Node; import javafx.scene.Scene; -import javafx.scene.control.ContentDisplay; -import javafx.scene.control.Label; import javafx.scene.control.ScrollBar; import javafx.scene.control.TextArea; import javafx.scene.control.Tooltip; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; import javafx.scene.layout.Region; -import javafx.scene.text.Text; import javafx.geometry.Orientation; @@ -101,9 +98,6 @@ import lombok.extern.slf4j.Slf4j; -import de.jensd.fx.glyphs.GlyphIcons; -import de.jensd.fx.glyphs.materialdesignicons.utils.MaterialDesignIconFactory; - @Slf4j public class GUIUtil { public final static String SHOW_ALL_FLAG = "SHOW_ALL_FLAG"; @@ -549,12 +543,4 @@ public static void removeChildrenFromGridPaneRows(GridPane gridPane, int start, childByRowMap.get(i).forEach(child -> gridPane.getChildren().remove(child)); } } - - public static Text addMaterialDesignIcon(GlyphIcons icon, Label label) { - final Text textIcon = MaterialDesignIconFactory.get().createIcon(icon); - textIcon.setOpacity(0.7); - label.setContentDisplay(ContentDisplay.LEFT); - label.setGraphic(textIcon); - return textIcon; - } } From d527eeb0ecd09a4b6b4b8805295839b9730f7a2a Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 26 Mar 2018 16:47:02 +0200 Subject: [PATCH 5/6] Replace toggle button with toggle icon and enable/disable active offer type --- src/main/java/bisq/desktop/bisq.css | 3 + .../offer/createoffer/CreateOfferView.java | 71 ++++++------------- .../java/bisq/desktop/util/BSFormatter.java | 8 ++- .../java/bisq/desktop/util/FormBuilder.java | 23 ++++-- 4 files changed, 50 insertions(+), 55 deletions(-) diff --git a/src/main/java/bisq/desktop/bisq.css b/src/main/java/bisq/desktop/bisq.css index 9372a938339..c87894aa52d 100644 --- a/src/main/java/bisq/desktop/bisq.css +++ b/src/main/java/bisq/desktop/bisq.css @@ -133,10 +133,12 @@ bg color of non edit textFields: fafafa .highlight, .highlight-static { -fx-text-fill: -fx-accent; + -fx-fill: -fx-accent; } .highlight:hover { -fx-text-fill: -bs-black; + -fx-fill: -bs-black; } .info { @@ -296,6 +298,7 @@ bg color of non edit textFields: fafafa .hidden-icon-button { -fx-background-color: transparent; + -fx-cursor: hand; } #icon-button { diff --git a/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java b/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java index bb61159e36c..6a671308e8a 100644 --- a/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java +++ b/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java @@ -23,7 +23,6 @@ import bisq.desktop.components.AddressTextField; import bisq.desktop.components.AutoTooltipButton; import bisq.desktop.components.AutoTooltipLabel; -import bisq.desktop.components.AutoTooltipToggleButton; import bisq.desktop.components.BalanceTextField; import bisq.desktop.components.BusyAnimation; import bisq.desktop.components.FundsTextField; @@ -82,8 +81,6 @@ import javafx.scene.control.ScrollPane; import javafx.scene.control.Separator; import javafx.scene.control.TextField; -import javafx.scene.control.ToggleButton; -import javafx.scene.control.ToggleGroup; import javafx.scene.control.Tooltip; import javafx.scene.image.Image; import javafx.scene.image.ImageView; @@ -104,6 +101,7 @@ import org.fxmisc.easybind.EasyBind; import org.fxmisc.easybind.Subscription; +import javafx.beans.binding.Bindings; import javafx.beans.value.ChangeListener; import javafx.event.ActionEvent; @@ -144,8 +142,7 @@ public class CreateOfferView extends ActivatableViewAndModel paymentAccountsComboBox; private ComboBox currencyComboBox; private ImageView imageView, qrCodeImageView; private VBox fixedPriceBox, percentagePriceBox; - private HBox fundingHBox, firstRowHBox, secondRowHBox, toggleButtonsHBox, - buyerSecurityDepositValueCurrencyBox; + private HBox fundingHBox, firstRowHBox, secondRowHBox, buyerSecurityDepositValueCurrencyBox; private Subscription isWaitingForFundsSubscription, balanceSubscription, cancelButton2StyleSubscription; private ChangeListener amountFocusedListener, minAmountFocusedListener, volumeFocusedListener, @@ -529,7 +525,7 @@ private void addBindings() { marketBasedPriceLabel.prefWidthProperty().bind(priceCurrencyLabel.widthProperty()); volumeCurrencyLabel.textProperty().bind(model.tradeCurrencyCode); - priceDescriptionLabel.textProperty().bind(createStringBinding(() -> btcFormatter.getPriceWithCurrencyCode(model.tradeCurrencyCode.get()), model.tradeCurrencyCode)); + priceDescriptionLabel.textProperty().bind(createStringBinding(() -> btcFormatter.getPriceWithCurrencyCode(model.tradeCurrencyCode.get(), "shared.fixedPriceInCurForCur"), model.tradeCurrencyCode)); xLabel.setText("x"); volumeDescriptionLabel.textProperty().bind(createStringBinding(model.volumeDescriptionLabel::get, model.tradeCurrencyCode, model.volumeDescriptionLabel)); amountTextField.textProperty().bindBidirectional(model.amount); @@ -725,8 +721,8 @@ private void updateMarketPriceAvailable() { boolean isMarketPriceAvailable = marketPriceAvailableValue == 1; percentagePriceBox.setVisible(isMarketPriceAvailable); percentagePriceBox.setManaged(isMarketPriceAvailable); - toggleButtonsHBox.setVisible(isMarketPriceAvailable); - toggleButtonsHBox.setManaged(isMarketPriceAvailable); + priceTypeToggleButton.setVisible(isMarketPriceAvailable); + priceTypeToggleButton.setManaged(isMarketPriceAvailable); boolean fixedPriceSelected = !model.dataModel.getUseMarketBasedPrice().get() || !isMarketPriceAvailable; updatePriceToggleButtons(fixedPriceSelected); } @@ -1083,6 +1079,7 @@ private void addAmountPriceFields() { Tuple3 priceAsPercentageTuple = getEditableValueCurrencyBox(Res.get("createOffer.price.prompt")); HBox priceAsPercentageValueCurrencyBox = priceAsPercentageTuple.first; marketBasedPriceTextField = priceAsPercentageTuple.second; + marketBasedPriceTextField.setPrefWidth(200); editOfferElements.add(marketBasedPriceTextField); marketBasedPriceLabel = priceAsPercentageTuple.third; editOfferElements.add(marketBasedPriceLabel); @@ -1091,34 +1088,20 @@ private void addAmountPriceFields() { percentagePriceDescription = priceAsPercentageInputBoxTuple.first; percentagePriceDescription.setPrefWidth(200); - getSmallIcon(MaterialDesignIcon.CHART_LINE, percentagePriceDescription); + getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, percentagePriceDescription); percentagePriceBox = priceAsPercentageInputBoxTuple.second; // Fixed/Percentage toggle - ToggleGroup toggleGroup = new ToggleGroup(); - fixedPriceButton = new AutoTooltipToggleButton(Res.get("createOffer.fixed")); - editOfferElements.add(fixedPriceButton); - fixedPriceButton.setId("toggle-price-left"); - fixedPriceButton.setToggleGroup(toggleGroup); - fixedPriceButton.selectedProperty().addListener((ov, oldValue, newValue) -> { - updatePriceToggleButtons(newValue); - }); + priceTypeToggleButton = getIconButton(MaterialDesignIcon.SWAP_VERTICAL); + editOfferElements.add(priceTypeToggleButton); - useMarketBasedPriceButton = new AutoTooltipToggleButton(Res.get("createOffer.percentage")); - editOfferElements.add(useMarketBasedPriceButton); - useMarketBasedPriceButton.setId("toggle-price-right"); - useMarketBasedPriceButton.setToggleGroup(toggleGroup); - useMarketBasedPriceButton.selectedProperty().addListener((ov, oldValue, newValue) -> { - updatePriceToggleButtons(!newValue); + priceTypeToggleButton.setOnAction((actionEvent) -> { + updatePriceToggleButtons(model.dataModel.getUseMarketBasedPrice().getValue()); }); - toggleButtonsHBox = new HBox(); - toggleButtonsHBox.setPadding(new Insets(16, 0, 0, 0)); - toggleButtonsHBox.getChildren().addAll(fixedPriceButton, useMarketBasedPriceButton); - // = - Label resultLabel = new AutoTooltipLabel("="); + resultLabel = new AutoTooltipLabel("="); resultLabel.setFont(Font.font("Helvetica-Bold", 20)); resultLabel.setPadding(new Insets(14, 2, 0, 2)); @@ -1137,7 +1120,7 @@ private void addAmountPriceFields() { firstRowHBox = new HBox(); firstRowHBox.setSpacing(5); firstRowHBox.setAlignment(Pos.CENTER_LEFT); - firstRowHBox.getChildren().addAll(amountBox, xLabel, percentagePriceBox, toggleButtonsHBox, resultLabel, volumeBox); + firstRowHBox.getChildren().addAll(amountBox, xLabel, percentagePriceBox, priceTypeToggleButton, resultLabel, volumeBox); GridPane.setRowIndex(firstRowHBox, gridRow); GridPane.setColumnIndex(firstRowHBox, 1); GridPane.setMargin(firstRowHBox, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 10, 0, 0)); @@ -1151,23 +1134,10 @@ private void updatePriceToggleButtons(boolean fixedPriceSelected) { if (marketPriceAvailable == 1) { model.dataModel.setUseMarketBasedPrice(!fixedPriceSelected); - - if (!fixedPriceButton.isSelected() && fixedPriceSelected) - fixedPriceButton.setSelected(true); - if (useMarketBasedPriceButton.isSelected() && !fixedPriceSelected) - useMarketBasedPriceButton.setSelected(false); } - fixedPriceButton.setMouseTransparent(fixedPriceSelected); - useMarketBasedPriceButton.setMouseTransparent(!fixedPriceSelected); - - fixedPriceButton.getStyleClass().removeAll("toggle-button-active", "toggle-button-inactive"); - useMarketBasedPriceButton.getStyleClass().removeAll("toggle-button-active", "toggle-button-inactive"); - - fixedPriceButton.getStyleClass().add(fixedPriceSelected ? - "toggle-button-active" : "toggle-button-inactive"); - useMarketBasedPriceButton.getStyleClass().add(!fixedPriceSelected ? - "toggle-button-active" : "toggle-button-inactive"); + percentagePriceBox.setDisable(fixedPriceSelected); + fixedPriceBox.setDisable(!fixedPriceSelected); if (fixedPriceSelected) { if (firstRowHBox.getChildren().contains(percentagePriceBox)) @@ -1196,13 +1166,16 @@ private void addSecondRow() { Res.get("createOffer.price.prompt")); HBox priceValueCurrencyBox = priceValueCurrencyBoxTuple.first; fixedPriceTextField = priceValueCurrencyBoxTuple.second; + fixedPriceTextField.setPrefWidth(200); editOfferElements.add(fixedPriceTextField); priceCurrencyLabel = priceValueCurrencyBoxTuple.third; editOfferElements.add(priceCurrencyLabel); Tuple2 priceInputBoxTuple = getTradeInputBox(priceValueCurrencyBox, ""); priceDescriptionLabel = priceInputBoxTuple.first; - getSmallIcon(MaterialDesignIcon.LOCK, priceDescriptionLabel); + priceDescriptionLabel.setPrefWidth(200); + + getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel); editOfferElements.add(priceDescriptionLabel); fixedPriceBox = priceInputBoxTuple.second; @@ -1230,7 +1203,7 @@ private void addSecondRow() { secondRowHBox = new HBox(); secondRowHBox.setSpacing(5); secondRowHBox.setAlignment(Pos.CENTER_LEFT); - secondRowHBox.getChildren().addAll(amountInputBoxTuple.second, xLabel, fixedPriceBox); + secondRowHBox.getChildren().addAll(amountInputBoxTuple.second, xLabel, fixedPriceBox, priceTypeToggleButton); GridPane.setRowIndex(secondRowHBox, ++gridRow); GridPane.setColumnIndex(secondRowHBox, 1); GridPane.setMargin(secondRowHBox, new Insets(0, 10, 0, 0)); diff --git a/src/main/java/bisq/desktop/util/BSFormatter.java b/src/main/java/bisq/desktop/util/BSFormatter.java index 84361d6bd59..76c2b91ad1f 100644 --- a/src/main/java/bisq/desktop/util/BSFormatter.java +++ b/src/main/java/bisq/desktop/util/BSFormatter.java @@ -715,10 +715,14 @@ public String getCurrencyNameAndCurrencyPair(String currencyCode) { } public String getPriceWithCurrencyCode(String currencyCode) { + return getPriceWithCurrencyCode(currencyCode, "shared.priceInCurForCur"); + } + + public String getPriceWithCurrencyCode(String currencyCode, String translationKey) { if (CurrencyUtil.isCryptoCurrency(currencyCode)) - return Res.get("shared.priceInCurForCur", Res.getBaseCurrencyCode(), currencyCode); + return Res.get(translationKey, Res.getBaseCurrencyCode(), currencyCode); else - return Res.get("shared.priceInCurForCur", currencyCode, Res.getBaseCurrencyCode()); + return Res.get(translationKey, currencyCode, Res.getBaseCurrencyCode()); } public Locale getLocale() { diff --git a/src/main/java/bisq/desktop/util/FormBuilder.java b/src/main/java/bisq/desktop/util/FormBuilder.java index 5b72f120155..721fb61a9aa 100644 --- a/src/main/java/bisq/desktop/util/FormBuilder.java +++ b/src/main/java/bisq/desktop/util/FormBuilder.java @@ -82,6 +82,7 @@ public class FormBuilder { private static final Logger log = LoggerFactory.getLogger(FormBuilder.class); + public static final String MATERIAL_DESIGN_ICONS = "'Material Design Icons'"; /////////////////////////////////////////////////////////////////////////////////////////// @@ -1192,8 +1193,8 @@ public static void removeRowsFromGridPane(GridPane gridPane, int fromGridRow, in // Icons /////////////////////////////////////////////////////////////////////////////////////////// - public static Text getIcon(GlyphIcons icon, String iconSize, Label label) { - if (icon.fontFamily().equals("'Material Design Icons'")) { + public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label) { + if (icon.fontFamily().equals(MATERIAL_DESIGN_ICONS)) { final Text textIcon = MaterialDesignIconFactory.get().createIcon(icon, iconSize); textIcon.setOpacity(0.7); label.setContentDisplay(ContentDisplay.LEFT); @@ -1204,8 +1205,22 @@ public static Text getIcon(GlyphIcons icon, String iconSize, Label label) { } } - public static Text getSmallIcon(GlyphIcons icon, Label label) { - return getIcon(icon, "0.769em", label); + public static Text getSmallIconForLabel(GlyphIcons icon, Label label) { + return getIconForLabel(icon, "0.769em", label); + } + + public static Button getIconButton(GlyphIcons icon) { + if (icon.fontFamily().equals(MATERIAL_DESIGN_ICONS)) { + final Button textIcon = MaterialDesignIconFactory.get().createIconButton(icon, "","2em", null, ContentDisplay.CENTER); + textIcon.setId("icon-button"); + textIcon.getGraphic().getStyleClass().add("highlight"); + textIcon.setPrefWidth(20); + textIcon.setPrefHeight(20); + textIcon.setPadding(new Insets(0)); + return textIcon; + } else { + throw new IllegalArgumentException("Not supported icon type"); + } } } From 779f42beeef766f34739096dee3b31e395052a9b Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 26 Mar 2018 17:32:30 +0200 Subject: [PATCH 6/6] Use absolut value again, as there was a reason for using it that way --- src/main/java/bisq/desktop/bisq.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/bisq/desktop/bisq.css b/src/main/java/bisq/desktop/bisq.css index c87894aa52d..23c0443db6c 100644 --- a/src/main/java/bisq/desktop/bisq.css +++ b/src/main/java/bisq/desktop/bisq.css @@ -207,7 +207,7 @@ bg color of non edit textFields: fafafa } .default-text { - -fx-font-size: 1em; + -fx-font-size: 13; } /* Splash */