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

Graphic node isn't vertically aligned on button

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: fx2.0, fx2.0.1
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      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

              • Assignee:
                jasper Jasper Potts
                Reporter:
                ndarcy Nick D'Arcy
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: