Maybe a TitledPane bug
David Grieve
david.grieve at oracle.com
Thu Nov 1 13:45:13 UTC 2018
It's hard to tell without some short, self-contained, correct example.
This sample I crafted here doesn't reproduce the issue.
@Override public void start(Stage primaryStage) {
final TitledPane titledPane =new TitledPane("Button Pane",new Button("Button"));
final HBox root =new HBox();
root.getChildren().add(titledPane);
primaryStage.setTitle("Maybe a TitledPane bug");
primaryStage.setScene(new Scene(root,300,250));
primaryStage.show();
final Region titleNode = (Region)titledPane.lookup("*.title");
titleNode.setBackground(new Background(new BackgroundFill(Color.GREEN,null,null)));
}
On 10/31/18 6:58 PM, Sverre Moe wrote:
> I am not sure if I have stumbled upon a bug in JavaFX, or perhaps it is
> simply something I am doing wrong.
>
> After setting the TitledPane title background programmatically, then when
> hovering the background color is reset to the previous value from CSS.
> I get same behavior in both JavaFX 8 and JavaFX 11.
>
> Color color = Color.valueOf("#00ff11");
> titleNode.setBackground(new Background(new BackgroundFill(color, null,
> null)));
>
> titleNode.setStyle("-fx-background-color:#00ff11;");
>
> Setting the style property seems to work, but why doesn't the
> programmatically approach work?
>
> https://stackoverflow.com/questions/53083005/javafx-titledpane-changed-title-background-is-reset-on-mouse-entered/
>
> /Sverre
More information about the openjfx-dev
mailing list