0

I am working on an JavaFX application and I have to set system related information in a JavaFX label.

I am doing like given as below:

systemInfo.setHdUsageTxt(Integer.toString(Runtime.getRuntime().availableProcessors()));

Here hdUsageTxt is a JavaFX label in which I have to set number of available processors at a time. But it is not setting String or Integer value in this label. And giving exception. Please suggest which type of data JavaFX label and TextField takes and how to set value in it?

4

1 回答 1

0

尝试

systemInfo.getHdUsageTxt().setText(Integer.toString(Runtime.getRuntime().availableProcessors()));

如果没有帮助,请发布您的异常堆栈跟踪。
两者javafx.scene.control.Label都有javafx.scene.control.TextField一个 text 属性,它的类型是javafx.beans.property.StringProperty. setText(String text)您可以使用和访问此属性的值getText()

于 2012-10-31T12:07:12.570 回答