JavaFX-2 ߝ设置几种样式
我正在尝试更改 javafx-2 中 TextArea 的背景和文本颜色。
myComponent = new TextArea();
myComponent.setStyle("-fx-text-fill : white;");
myComponent.setStyle("-fx-background-color : black;");
myComponent.setStyle("-fx-font : " + GUIConstants.SysResponseFont.getName());
myComponent.setStyle("-fx-font-family : " + GUIConstants.SysResponseFont.getFamily());
myComponent.setStyle("-fx-font-size : " + GUIConstants.SysResponseFont.getSize());
myComponent.setStyle("-fx-font-weight : " + GUIConstants.SysResponseFont.getStyle());
此 TextArea 中既没有设置颜色也没有设置字体。我必须使用不同的方法吗?
I'm trying to change the background and text-color of a TextArea in javafx-2.
myComponent = new TextArea();
myComponent.setStyle("-fx-text-fill : white;");
myComponent.setStyle("-fx-background-color : black;");
myComponent.setStyle("-fx-font : " + GUIConstants.SysResponseFont.getName());
myComponent.setStyle("-fx-font-family : " + GUIConstants.SysResponseFont.getFamily());
myComponent.setStyle("-fx-font-size : " + GUIConstants.SysResponseFont.getSize());
myComponent.setStyle("-fx-font-weight : " + GUIConstants.SysResponseFont.getStyle());
Neither the colors nor the font gets set in this TextArea. Do I have to use a different approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
后面的
setStyle()
会覆盖前面的。下一个代码将设置几种样式:我想对于您的代码片段来说,它将是:
注意行末尾的
;
符号。Your latter
setStyle()
overrides previous ones. Next code will set several styles:I guess for your code snippet it would be:
Note the
;
signs at the end of the lines.