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

[Button] Text offset has changed when some overrun styles are applied.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Environment:

      jdk 1.8.0-ea-b59

      Description

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.ButtonBuilder;
      import javafx.scene.control.LabelBuilder;
      import javafx.scene.control.OverrunStyle;
      import javafx.scene.layout.GridPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class TextOverrun extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {

              String text = "one two three four five six seven eight nine";
              VBox root = new VBox(20d);
              
              int row = 0;
              int col = 0;
              for (final OverrunStyle overrun : new OverrunStyle[] {OverrunStyle.CLIP, OverrunStyle.ELLIPSIS}) {
                  VBox vb = new VBox(5d);
                  
                  vb.getChildren().add(LabelBuilder.create().text("[" + overrun + "]").build());
                  
                  Button btn = ButtonBuilder.create()
                          .text(text)
                          .textOverrun(overrun)
                          .wrapText(false)
                          .maxHeight(20)
                          .maxWidth(150)
                          .build();
                  vb.getChildren().add(btn);
                  
                  root.getChildren().add(vb);
              }

              Scene scene = new Scene(root);
              stage.setScene(scene);
              stage.show();
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              miflemi Mick Fleming (Inactive)
              Reporter:
              dzinkevi Dmitry Zinkevich (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: