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

Clicking Button with different Padding causes hover-padding of other button

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • jfx11, jfx20, jfx19, jfx21
    • javafx
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      When I create a button and set the padding property, I get the following unexpected behavior:
      An entirely unrelated button changes it's padding to 0 when I hover over it with my mouse. This button is entirely unrelated and should not ever be influenced by the first button.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Setup JavaFX application with the below source code. Press the "weirdButton" (narrow one without text) WIHTOUT hovering over the "cancelButton" (text=Abbrechen), then hover over Abbrechen button. Only then does the cancel button hover behavior break.
      Use the following maven dependency:
      <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>19.0.2.1</version>
      </dependency>

      Specific OS: Ubuntu 20.04.6 LTS

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Padding of the "weirdButton" is affected, "cancelButton" does not change.
      ACTUAL -
      "cancelButton" changes padding to 0 when hovering.

      ---------- BEGIN SOURCE ----------
      package testing;

      import javafx.application.Application;
      import javafx.geometry.Insets;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class MVE extends Application {
          @Override
          public void start(Stage primaryStage) {
              var root = new StackPane();
              var vbox = new VBox();
              var hbox = new HBox();
              var textBox = new VBox();
              var textField = new TextField();
              textBox.getChildren().add(textField);
              var label = new Label("TestLabel");
              var weirdButton = new Button();
              weirdButton.setText("");
              weirdButton.setPadding(new Insets(2.0));
              hbox.getChildren().add(label);
              hbox.getChildren().add(weirdButton);
              vbox.getChildren().add(textBox);
              vbox.getChildren().add(hbox);
              var cancelButton = new Button("Abbrechen");
              cancelButton.setCancelButton(true);
              vbox.getChildren().add(cancelButton);
              root.getChildren().add(vbox);
              var scene = new Scene(root, 640, 480);
              primaryStage.setScene(scene);
              primaryStage.setTitle("MVE");
              primaryStage.setResizable(false);
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

            kpk Karthik P K
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: