When a Button is added to a TitledPane in the title area, moving the mouse over anywhere in the title area will highlight the button as if it is hovered over even if it is not. The button does *not* receive MouseEntered events when this happens (unless the mouse actually enters the button area), but the appearance indicates that it does.
Repro example:
public class TitleHover extends Application {
@Override
public void start(Stage primaryStage) {
TitledPane titledPane = new TitledPane("Text", new Button("Content button"));
titledPane.setGraphic(new Button("Button"));
titledPane.setCollapsible(false);
Platform.runLater(() -> {
titledPane.lookup(".title").setStyle("-fx-background-color: rgba(255, 255, 255, 1);"
+ "-fx-border-style: solid;" + "-fx-border-color: rgba(0, 0, 0, 1);" + "-fx-border-width: 1px;");
titledPane.lookup(".content").setStyle("-fx-background-color: rgba(255, 255, 255, 1);"
+ "-fx-border-style: solid;" + "-fx-border-color: rgba(0, 0, 0, 1);" + "-fx-border-width: 1px;");
});
primaryStage.setScene(new Scene(titledPane));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Since a button is not what the title area (or graphic area specifically) is designed to hold, even though it accepts any Node, I can understand if this is not a bug.
Repro example:
public class TitleHover extends Application {
@Override
public void start(Stage primaryStage) {
TitledPane titledPane = new TitledPane("Text", new Button("Content button"));
titledPane.setGraphic(new Button("Button"));
titledPane.setCollapsible(false);
Platform.runLater(() -> {
titledPane.lookup(".title").setStyle("-fx-background-color: rgba(255, 255, 255, 1);"
+ "-fx-border-style: solid;" + "-fx-border-color: rgba(0, 0, 0, 1);" + "-fx-border-width: 1px;");
titledPane.lookup(".content").setStyle("-fx-background-color: rgba(255, 255, 255, 1);"
+ "-fx-border-style: solid;" + "-fx-border-color: rgba(0, 0, 0, 1);" + "-fx-border-width: 1px;");
});
primaryStage.setScene(new Scene(titledPane));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Since a button is not what the title area (or graphic area specifically) is designed to hold, even though it accepts any Node, I can understand if this is not a bug.
- links to