-
Bug
-
Resolution: Unresolved
-
P4
-
8u45
Selecting or simply moving the cursor in a TextArea seems to initiate a layout pass on Scene level.
Assume the following test application:
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setScene(new Scene(new NotifyingPane(new StackPane(new StackPane(new StackPane(new TextArea("Test TextArea")))))));
primaryStage.setTitle("JavaFX Layout Test");
primaryStage.show();
}
private static final class NotifyingPane extends StackPane {
public NotifyingPane(Node... pChildren) {
super(pChildren);
}
@Override
protected void layoutChildren() {
System.out.println("layoutChildren");
super.layoutChildren();
}
@Override
public void requestLayout() {
System.out.println("requestLayout");
super.requestLayout();
}
}
}
1. Start the test application.
2. The text area is focused, move the cursor with the arrow keys.
3. "requestLayout" is printed twice followed by "layoutChildren".
I'm not a hundred percent sure about that, but I think that moving the cursor in a TextArea should not initiate a layout pass on Scene level.
Assume the following test application:
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setScene(new Scene(new NotifyingPane(new StackPane(new StackPane(new StackPane(new TextArea("Test TextArea")))))));
primaryStage.setTitle("JavaFX Layout Test");
primaryStage.show();
}
private static final class NotifyingPane extends StackPane {
public NotifyingPane(Node... pChildren) {
super(pChildren);
}
@Override
protected void layoutChildren() {
System.out.println("layoutChildren");
super.layoutChildren();
}
@Override
public void requestLayout() {
System.out.println("requestLayout");
super.requestLayout();
}
}
}
1. Start the test application.
2. The text area is focused, move the cursor with the arrow keys.
3. "requestLayout" is printed twice followed by "layoutChildren".
I'm not a hundred percent sure about that, but I think that moving the cursor in a TextArea should not initiate a layout pass on Scene level.