Code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
/**
* @author alexandr_kirov
*/
public class JavaFX_TextArea_ScrollTopLeft extends Application {
public static void main(String[] args) {
launch();
}
@Override
public void start(Stage stage) throws Exception {
final TextArea ta = new TextArea();
for (int i = 0; i < 1000; i++) {
ta.setText(ta.getText() + " some text");
if (i % 10 == 0)
ta.setText(ta.getText() + "\n");
}
VBox vb = new VBox(5);
vb.getChildren().addAll(ta);
Scene scene = new Scene(vb, 300, 300);
stage.setScene(scene);
stage.show();
}
}
It makes, so that there must be a new line after 10 strings. But I see that, what is on attached screenshot.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
/**
* @author alexandr_kirov
*/
public class JavaFX_TextArea_ScrollTopLeft extends Application {
public static void main(String[] args) {
launch();
}
@Override
public void start(Stage stage) throws Exception {
final TextArea ta = new TextArea();
for (int i = 0; i < 1000; i++) {
ta.setText(ta.getText() + " some text");
if (i % 10 == 0)
ta.setText(ta.getText() + "\n");
}
VBox vb = new VBox(5);
vb.getChildren().addAll(ta);
Scene scene = new Scene(vb, 300, 300);
stage.setScene(scene);
stage.show();
}
}
It makes, so that there must be a new line after 10 strings. But I see that, what is on attached screenshot.