【发布时间】:2019-08-13 19:23:27
【问题描述】:
我有一个系统,它在 Javafx 中创建一个新标签,该标签是预定义的,但只是在运行方法时在现场创建。 我希望能够编辑创建的标签的背景颜色。
countSendResponses++
mainLayout.add(new Label(messageSend), 0, countSendResponces).Color.rgb(1, 1, 1);
// that gives an error, I have tried the same thing in different places in that line of code. Nothing works
我当前的代码: countSendResponses++ mainLayout.add(new Label(messageSend), 0, countSendResponces);
有没有办法做到这一点?如果有更好的方法来做我正在做的事情,我愿意接受建议。我希望能够更改标签的背景颜色。谢谢!
【问题讨论】:
-
messageSend 等于我要发送的消息。我认为不需要任何代码来解释,因为它只是放置在标签中的字符串。如果需要,我会提供该代码。
-
在添加/修改之前将
Label存储在一个局部变量中。
标签: java javafx attributes grid-layout gridpane