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).
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).
- relates to
-
JDK-8089011 [TextArea] not all text is visible in process of selection.
-
- Open
-