[TextArea] prefColumnCount and prefRowCount are not applied immediately.

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P4
    • 8u20
    • Affects Version/s: fx2.1, 8
    • Component/s: javafx
    • Environment:

      2.1b06

      Code:


      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Slider;
      import javafx.scene.control.SliderBuilder;
      import javafx.scene.control.TextArea;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      /**
       * @author alexandr_kirov
       */
      public class JavaFX_TextArea_PrefCount extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {
              final TextArea ta = new TextArea();
              ta.setWrapText(true);
              for (int i = 0; i < 1000; i++) {
                  ta.setText(ta.getText() + " some text");
                  if (i % 10 == 0) {
                      ta.setText(ta.getText() + "\n");
                  }
              }

              final Slider s1 = SliderBuilder.create().max(200).min(0).value(10).majorTickUnit(50).minorTickCount(49).showTickLabels(true).showTickMarks(true).build();
              final Slider s2 = SliderBuilder.create().max(200).min(0).value(10).majorTickUnit(50).minorTickCount(49).showTickLabels(true).showTickMarks(true).build();

              ta.prefColumnCountProperty().bind(s1.valueProperty());
              ta.prefRowCountProperty().bind(s2.valueProperty());

              Pane pane = new Pane();
              pane.setPrefWidth(200);
              pane.setPrefHeight(200);

              pane.getChildren().addAll(ta);

              VBox vb = new VBox(5);
              vb.getChildren().addAll(pane, s1, s2);
              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }
      }

      Steps to reproduce:
      Change values of sliders and try to resize scene window. Changes will be applied only after window resize. Try to change pref counts again and resize window again. It doesn't help now.

      Also see attached movie.

            Assignee:
            Jonathan Giles
            Reporter:
            Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: