के साथ जावाएफएक्स बाइंडिंग लेबल मैं int
मान के साथ जावाएफएक्स Label.textProperty
को बांधना चाहता हूं।इंट मान
मैंने उदाहरण की कोशिश की
Label.textProperty().bindBidirectional(new SimpleIntegerProperty(myInt),
new NumberStringConverter());
या
Label().textProperty().bindBidirectional(new SimpleIntegerProperty(myInt),
new DecimalFormat());
लेकिन मैं हमेशा NullPointerException मिलता है।
मैं इसे कैसे ठीक कर सकता हूं?
किसी भी कारणों से उपयोग कर सकते हैं लेबल पर बिडरेक्शनल बाध्यकारी का उपयोग करने के लिए? – ItachiUchiha
@IachachiUchiha संभवतः क्योंकि यह एक 'स्ट्रिंग कनवर्टर' प्रदान करने की अनुमति देता है। मैंने कोशिश की कि इससे पहले कि मैंने पाया कि आप एक unidirectional बाध्यकारी के साथ 'integerProperty.asString() 'का उपयोग कर सकते हैं जैसा कि आपने अपने उत्तर में बताया था। – Ruben9922