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

[TextField, Selection] not whole selected text is shown.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 8
    • 7u6
    • javafx
    • 2.2.0b13.

      Code:


      import java.util.logging.Level;
      import java.util.logging.Logger;
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

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

          public static void main(String[] args) {
              new Thread(new Runnable() {

                  @Override
                  public void run() {
                      try {
                          parallelThread();
                      } catch (InterruptedException ex) {
                          Logger.getLogger(App2.class.getName()).log(Level.SEVERE, null, ex);
                      }
                  }
              }).start();

              launch(args);
          }
          static TextField tf;
          static String str = "one two three four five";

          @Override
          public void start(Stage stage) throws Exception {
              HBox vb = new HBox();

              tf = new TextField(str);
              tf.setPrefSize(100, 24);

              vb.getChildren().addAll(tf);

              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }

          public static void parallelThread() throws InterruptedException {
              Thread.sleep(1000);
              int len = str.length();
              tf.end();
              Thread.sleep(1000);
              tf.selectRange(1, len / 2);
          }
      }

      Run this code to see, that only "wo thr" is shown as selected, but actually, "ne two thr" is selected.

      I think, this is different from RT-19749, because I use different commands (methods).

            leifs Leif Samuelsson (Inactive)
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: