我正在尝试开发一个看起来像终端机的应用程序,正在使用TextArea,但我希望是黑色背景和绿色文字,
我想在不使用任何ccs模板的情况下做到这一点
我知道我的问题看起来像是在这里重复的:
要么
但是在阅读了这些内容并尝试了他们的建议之后,我发现没有运气可以解决我的问题
到目前为止我尝试过的是:
在FXML中:
<TextArea
fx:id="terminalTextArea"
layoutX="14.0"
layoutY="85.0"
prefHeight="64.0"
prefWidth="402.0"
style="-fx-font-family: Consolas; -fx-highlight-fill: #00ff00; -fx-highlight-text-fill: #000000; -fx-text-fill: #00ff00; -fx-background-color:#000000;"
text="Terminal"
AnchorPane.leftAnchor="10.0"
AnchorPane.rightAnchor="10.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</TextArea>
Run Code Online (Sandbox Code Playgroud)
但没有运气....
并在源代码中:
@Override
public void initialize(URL url, ResourceBundle rb) {
System.out.println("init here");
terminalTextArea.setStyle("-fx-text-fill: black;");
}
Run Code Online (Sandbox Code Playgroud)
我唯一得到的是带有边框的颜色,如下图所示。
你们中的任何一个人以前有同样的问题吗????
提前发送