2015-10-26 70 views
-1

我想顯示PDF的頁碼。當前頁面保存在Int currentpage;。我創建了一個標籤,如Label pagenumber = new Label();。我嘗試了pagenumber.textProperty().bind(currentpage);,但後來Eclipse要求我改變ObservableValue <? extends String >中的currentPage。我認爲做我想做的事情非常容易,但我對JavaFX很新。對不起,容易的問題。JavaFX中的顯示變量(Int)

謝謝

+3

/PLS /主題/查找?CTX = javase80&ID = JFXBD107)。 –

回答

1

這真的很容易。

我寫這個解決方案,也許它可能對JavaFX中像我這樣非常新的人有所幫助。

pagenumber.setText("" +currentPage); 

或一般

Label.setText("" +intValue); 
0

如果你想使用屬性和綁定我建議你閱讀[教程](http://www.oracle.com試試這個

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

添加一些解釋並回答這個答案如何幫助OP修復當前問題 –

+1

通常最好在你的文章中添加一段關於代碼如何工作的解釋。這使新開發人員能夠理解代碼的功能。 –