11 changed files with 119 additions and 16 deletions
@ -1 +1 @@ |
|||
Subproject commit 360550a7183683ad4ee929a4c5411075bd751ffd |
|||
Subproject commit bdb9900d8d94f62b8714e14e151635813c7c258d |
@ -0,0 +1,47 @@ |
|||
package com.sparrowwallet.sparrow.control; |
|||
|
|||
import javafx.beans.property.ObjectProperty; |
|||
import javafx.beans.property.SimpleObjectProperty; |
|||
import javafx.scene.Cursor; |
|||
import javafx.scene.Node; |
|||
import javafx.scene.control.ComboBox; |
|||
import javafx.scene.layout.Region; |
|||
import javafx.scene.layout.StackPane; |
|||
import org.controlsfx.control.textfield.CustomTextField; |
|||
|
|||
public class ComboBoxTextField extends CustomTextField { |
|||
private final ObjectProperty<ComboBox<?>> comboProperty = new SimpleObjectProperty<>(); |
|||
|
|||
public ComboBoxTextField() { |
|||
super(); |
|||
getStyleClass().add("combo-text-field"); |
|||
setupCopyButtonField(super.rightProperty()); |
|||
} |
|||
|
|||
private void setupCopyButtonField(ObjectProperty<Node> rightProperty) { |
|||
Region showComboButton = new Region(); |
|||
showComboButton.getStyleClass().addAll("graphic"); //$NON-NLS-1$
|
|||
StackPane showComboButtonPane = new StackPane(showComboButton); |
|||
showComboButtonPane.getStyleClass().addAll("combo-button"); //$NON-NLS-1$
|
|||
showComboButtonPane.setCursor(Cursor.DEFAULT); |
|||
showComboButtonPane.setOnMouseReleased(e -> { |
|||
if(comboProperty.isNotNull().get()) { |
|||
comboProperty.get().show(); |
|||
} |
|||
}); |
|||
|
|||
rightProperty.set(showComboButtonPane); |
|||
} |
|||
|
|||
public ComboBox<?> getComboProperty() { |
|||
return comboProperty.get(); |
|||
} |
|||
|
|||
public ObjectProperty<ComboBox<?>> walletComboProperty() { |
|||
return comboProperty; |
|||
} |
|||
|
|||
public void setComboProperty(ComboBox<?> comboProperty) { |
|||
this.comboProperty.set(comboProperty); |
|||
} |
|||
} |
Loading…
Reference in new issue