I am using a PopOver that contains a TextField and is displayed when the user clicks on the imageView of a CustomTextField. When I type inside the inner TextField, everything goes fine until I enter a stressed vowel, which to my surprise is picked up by the outer TextField instead of the inner one.
I show pictures of what happens, whenpopover.show(imageView)
When the popover is shown from a button there is no problempopover.show(button)
I don't know, it seems to be a bug. If anyone has any ideas as to why this is happening I would appreciate any help. Thank you
EDIT: Here I reproduce an example of code in which the effect that I mention is produced, when you introduce a vowel with a tilde in the internal textfield, it does not appear in the internal one, but it does in the external one.
public class PopOverTest extends Application {
@Override
public void start(Stage primaryStage) {
CustomTextField externo = new CustomTextField();
ImageView imgView = new ImageView(new Image("test/image.png"));
externo.setLeft(imgView);
CustomTextField interno = new CustomTextField();
PopOver popOver = new PopOver();
popOver.setContentNode(interno);
imgView.setOnMouseClicked(e -> {
popOver.show(imgView);
});
StackPane root = new StackPane();
root.getChildren().add(externo);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
I have found a solution to this problem.
It consists of changing the KeyEventDispather of the external TextField for the internal one and it works perfectly.
previously we save it to be able to restore it later:
To extend the example for the case where there is more than one internal TextField, change the EventDispatcher to that of each TextField when it receives focus and restore it when it loses focus.
I show the complete example with two inner TextFields: