Issue
How I can convert StringProperty to String? I need only text value. But my function is show to me "StringProperty [value: bbbbbb]" I know about JavaFX specific accessor syntax and accessors. But I could not understand how to put that correctly.
public class TestDelete {
private static StringProperty myTestValue = new SimpleStringProperty();
public static void main(String[] args) {
setText();
}
private static void setText() {
TestDelete testDelete = new TestDelete();
String myText = "aaaaa bbbbbb";
myTestValue = new SimpleStringProperty(myText.replaceAll(".* ", ""));
System.out.println(myTestValue);
}
public void getmyTestValue() {
myTestValue.get();
}
public void setmyTestValue(String newVal) {
myTestValue.set(newVal);
}
public StringProperty myTestValueProperty() {
return myTestValue;
}
}
Solution
Simple string property works as
public class NewBean {
SimpleStringProperty id = new SimpleStringProperty();
SimpleStringProperty name = new SimpleStringProperty();
public NewBean(){
}
public String getId() {
return id.get();
}
public SimpleStringProperty idProperty() {
return id;
}
public void setId(String id) {
this.id.set(id);
}
public String getName() {
return name.get();
}
public SimpleStringProperty nameProperty() {
return name;
}
public void setName(String name) {
this.name.set(name);
}
}
Answered By - Ranjit Vamadevan