This commit is contained in:
Craig Raw 2024-01-10 11:18:26 +02:00
parent e1d9d54da3
commit 540424a2e3

View file

@ -24,7 +24,11 @@ public class CopyableCoinLabel extends CopyableLabel {
this("Unknown");
}
private final EventHandler<MouseEvent> toggleBitcoinUnit = event -> {
public CopyableCoinLabel(String text) {
super(text);
valueProperty().addListener((observable, oldValue, newValue) -> setValueAsText((Long)newValue, Config.get().getUnitFormat(), Config.get().getBitcoinUnit()));
setOnMouseClicked(event -> {
if(bitcoinUnit == null) {
bitcoinUnit = Config.get().getBitcoinUnit();
}
@ -36,13 +40,7 @@ public class CopyableCoinLabel extends CopyableLabel {
}
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);
});
tooltip = new Tooltip();
contextMenu = new CoinContextMenu();