From 77fde3cda9022176b8d7f667fcb5cf16c61d7aa4 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 1 Feb 2022 10:08:58 +0200 Subject: [PATCH] improve label cell performance by avoiding clipboard retrieval --- .../sparrow/control/LabelCell.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/LabelCell.java b/src/main/java/com/sparrowwallet/sparrow/control/LabelCell.java index b949510b..93d765ac 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/LabelCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/LabelCell.java @@ -92,18 +92,15 @@ class LabelCell extends TextFieldTreeTableCell { }); getItems().add(copyLabel); - Object content = Clipboard.getSystemClipboard().getContent(DataFormat.PLAIN_TEXT); - if(content instanceof String) { - MenuItem pasteLabel = new MenuItem("Paste Label"); - pasteLabel.setOnAction(AE -> { - hide(); - Object currentContent = Clipboard.getSystemClipboard().getContent(DataFormat.PLAIN_TEXT); - if(currentContent instanceof String) { - entry.labelProperty().set((String)currentContent); - } - }); - getItems().add(pasteLabel); - } + MenuItem pasteLabel = new MenuItem("Paste Label"); + pasteLabel.setOnAction(AE -> { + hide(); + Object currentContent = Clipboard.getSystemClipboard().getContent(DataFormat.PLAIN_TEXT); + if(currentContent instanceof String) { + entry.labelProperty().set((String)currentContent); + } + }); + getItems().add(pasteLabel); } } }