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

[CheckBox] Content is not adjusted to the real size of control.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 8
    • 8
    • javafx
    • jdk 1.8.0-ea-b59

      Please, look at:
      http://aurora-ds.ru.oracle.com:9500/runs/109249.ManualSubmit-1/workDir/javafx/scene/control/test/labeled/CheckBoxesTest_setTextOverrunSingleLineTest/CheckBoxesTest-setTextOverrunSingleLine-expected.png
      http://aurora-ds.ru.oracle.com:9500/runs/109249.ManualSubmit-1/workDir/javafx/scene/control/test/labeled/CheckBoxesTest_setTextOverrunSingleLineTest/CheckBoxesTest-setTextOverrunSingleLine.png
      http://aurora-ds.ru.oracle.com:9500/runs/109249.ManualSubmit-1/workDir/javafx/scene/control/test/labeled/CheckBoxesTest_setTextOverrunSingleLineTest/CheckBoxesTest-setTextOverrunSingleLine-diff.png


      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.CheckBox;
      import javafx.scene.control.CheckBoxBuilder;
      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";
              GridPane gridPane = new GridPane();
              gridPane.setVgap(20d);
              gridPane.setHgap(20d);
              
              int row = 0;
              int col = 0;
              for (final OverrunStyle overrun : OverrunStyle.values()) {
                  VBox vb = new VBox(5d);
                  
                  vb.getChildren().add(LabelBuilder.create().text("[" + overrun + "]").build());
                  
                  CheckBox btn = CheckBoxBuilder.create()
                          .text(text)
                          .textOverrun(overrun)
                          .wrapText(false)
                          .prefWidth(105)
                          .maxWidth(250)
                          .minWidth(250)
                          .style("-fx-border-color:grey")
                          .build();
                  vb.getChildren().add(btn);
                  
                  gridPane.add(vb, col, row);

                  col++;

                  if (col % 3 == 0) {
                      col = 0;
                      row++;
                  }
              }

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

            Unassigned Unassigned
            dzinkevi Dmitry Zinkevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: