Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Setting the background color of a TextArea

2652198Apr 10 2014 — edited Apr 11 2014

I have not been able to set the background color of a text area. Here is what I am trying and it works for other components.

****************************************************************

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.control.TextArea;

public class TextAreaTest extends Application{
  public void start(Stage stage){
    TextArea area = new TextArea();
    area.setStyle("-fx-background-color: black; -fx-text-fill: lightgreen;");
    Scene s = new Scene(area);
    stage.setTitle("black text area");
    stage.setScene(s);
    stage.show();
  }
  public static void main(String[] args){
    launch(args);
  }

}

***************************************************************

I am using jdk 8 with whichever javafx version is included. I searched quite a bit on the internet and I seem to see mixed results using this technique.

Thank you.

This post has been answered by James_D on Apr 10 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2014
Added on Apr 10 2014
10 comments
6,425 views