我在javafx中創建了一個Label
,其中包含大量文本。setWrapText(true)不適用於JavaFX中的標籤
Label l1 = new Label("\t\tC-Mark and Attendance Calculator is a simple "
+ "software to find both the C-Mark and monthly attendance "
+ "of students. Inorder to use the features of this software,"
+ " user has to create an account for him first. Then he should "
+ "login using the username and password. He will be able to "
+ "perform all the operations then. Further details are mentioned"
+ " in the 'HELP' section in the user home page.");
l1.setWrapText(true);
l1.setTextAlignment(TextAlignment.JUSTIFY);
在此代碼中setWrapText(true)
不起作用。爲什麼?我怎樣才能使它工作?
你是如何確定一個沒有工作? –
@UlukBiy因爲我的標籤內容顯示在一行中。我不知道爲什麼會這樣。你能提出一個解決方案嗎? – TomJ
設置標籤的首選寬度。或者將標籤放入調整其子項的窗格中,例如HBox。 –