Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在JavaFX中显示变量(Int)_Javafx_Label - Fatal编程技术网

在JavaFX中显示变量(Int)

在JavaFX中显示变量(Int),javafx,label,Javafx,Label,我想显示PDF的页码。当前页面保存在Int currentpage中。我创建了一个标签,比如Label pagenumber=new Label()。我尝试了pagenumber.textProperty().bind(currentpage)但是Eclipse要求我在ObservalEvalue中更改currentPage,这真的很容易 我写了这个解决方案,也许它对像我这样的JavaFX新手会有帮助 pagenumber.setText("" +currentPage); 或者总体上 Lab

我想显示PDF的页码。当前页面保存在
Int currentpage中。我创建了一个标签,比如
Label pagenumber=new Label()。我尝试了
pagenumber.textProperty().bind(currentpage)
但是Eclipse要求我在
ObservalEvalue中更改currentPage,这真的很容易

我写了这个解决方案,也许它对像我这样的JavaFX新手会有帮助

pagenumber.setText("" +currentPage);
或者总体上

Label.setText("" +intValue);
这真的很容易

我写了这个解决方案,也许它对像我这样的JavaFX新手会有帮助

pagenumber.setText("" +currentPage);
或者总体上

Label.setText("" +intValue);
试试这个

pagenumber.setText(Integer.toString(currentPage));
试试这个

pagenumber.setText(Integer.toString(currentPage));

如果您想使用属性和绑定,我建议您阅读。如果您想使用属性和绑定,我建议您阅读。添加一些解释和答案,说明此答案如何帮助解决当前问题通常最好在您的帖子中添加一个解释,说明代码如何工作。这使新开发人员能够理解代码的作用。添加一些解释,并说明此答案如何帮助解决当前问题。通常,在您的帖子中添加一个关于代码如何工作的解释是一个好主意。这使新开发人员能够理解代码的作用。