Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8224173

Button in TitledPane's graphic looks like it it hovered over when it doesn't

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • jfx12
    • javafx
    • None

      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.

            aghaisas Ajit Ghaisas
            nlisker Nir Lisker
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: