titled-pane .content {
    -fx-background-color: green;
}

Cheers,
Mo

> On 25 Dec 2014, at 23:13, Peter Penzov <peter.pen...@gmail.com> wrote:
> 
> Hi All,
>   I have a question how to change TitledPane background color. I tested
> this code:
> 
> public class MainApp extends Application {
> 
>    @Override
>    public void start(Stage stage) throws Exception {
> 
>        TitledPane pane = new TitledPane("Title", null);
>        pane.setStyle("-fx-focus-color: transparent; -fx-background-color:
> green;");
>        pane.setCollapsible(false);
>        pane.setPrefSize(300, 500);
> 
> 
>        Scene scene = new Scene(pane);
> 
>        stage.setTitle("JavaFX and Maven");
>        stage.setScene(scene);
>        stage.show();
>    }
> 
>    public static void main(String[] args) {
>        launch(args);
>    }
> }
> 
> I tried to set the background color to green but when I run the code the
> background color is gray. What is the proper way to change the background
> color of the TitledPane body?
> 
> BR,
> Peter

Reply via email to