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

Graphic node isn't vertically aligned on button

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • 8
    • fx2.0, fx2.0.1
    • javafx
    • xp and osx

    Description

      If you have a button with no text and just a node added using setGraphic, I would hope it would be vertically aligned. It isn't at the moment. If you look at the attached image, you will see that there is an extra pixel at the bottom of the button compared to the top. The button should be 1 pixel less in height.

      Here is the code to reproduce:


      package test;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      public class ButtonTest extends Application {
          @Override
          public void start(Stage stage) throws Exception {
              BorderPane layout = new BorderPane();
              Scene scene = new Scene(layout, 400, 400);
              stage.setScene(scene);

              Rectangle rectangle = new Rectangle(30,30);
              Button button = new Button();
              button.setGraphic(rectangle);

              layout.setTop(button);

              stage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

      Attachments

        Issue Links

          Activity

            People

              jasper Jasper Potts (Inactive)
              ndarcy Nick D'Arcy
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: