From 540424a2e39e5cd2489e0de97d7ef61012b02162 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 10 Jan 2024 11:18:26 +0200 Subject: [PATCH] followup --- .../sparrow/control/CopyableCoinLabel.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/CopyableCoinLabel.java b/src/main/java/com/sparrowwallet/sparrow/control/CopyableCoinLabel.java index 500280c7..08d9c4c3 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/CopyableCoinLabel.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/CopyableCoinLabel.java @@ -24,25 +24,23 @@ public class CopyableCoinLabel extends CopyableLabel { this("Unknown"); } - private final EventHandler toggleBitcoinUnit = event -> { - if(bitcoinUnit == null) { - bitcoinUnit = Config.get().getBitcoinUnit(); - } - - if(bitcoinUnit == BitcoinUnit.SATOSHIS) { - bitcoinUnit = BitcoinUnit.BTC; - } else { - bitcoinUnit = BitcoinUnit.SATOSHIS; - } - - refresh(Config.get().getUnitFormat(), bitcoinUnit); - }; - public CopyableCoinLabel(String text) { super(text); valueProperty().addListener((observable, oldValue, newValue) -> setValueAsText((Long)newValue, Config.get().getUnitFormat(), Config.get().getBitcoinUnit())); - setOnMouseClicked(toggleBitcoinUnit); + setOnMouseClicked(event -> { + if(bitcoinUnit == null) { + bitcoinUnit = Config.get().getBitcoinUnit(); + } + + if(bitcoinUnit == BitcoinUnit.SATOSHIS) { + bitcoinUnit = BitcoinUnit.BTC; + } else { + bitcoinUnit = BitcoinUnit.SATOSHIS; + } + + refresh(Config.get().getUnitFormat(), bitcoinUnit); + }); tooltip = new Tooltip(); contextMenu = new CoinContextMenu();