Voglio associare JavaFX Label.textProperty
con il valore int
.Associazione JavaFX Etichetta con valore int.
Ho provato ad es.
Label.textProperty().bindBidirectional(new SimpleIntegerProperty(myInt),
new NumberStringConverter());
o
Label().textProperty().bindBidirectional(new SimpleIntegerProperty(myInt),
new DecimalFormat());
ma ottengo sempre NullPointerException.
Come posso risolvere il problema?
alcuna motivazione per usare il binding bidirezionale sull'etichetta? – ItachiUchiha
@ItachiUchiha Forse perché consente di fornire un 'StringConverter'. L'ho provato prima di scoprire che puoi usare 'integerProperty.asString()' con una rilegatura unidirezionale come hai indicato nella tua risposta. – Ruben9922