Reputation: 11
I would disable the keyboard when i show a webView browser in a scene with JavaFx, for example when I open Google with that browser i want you not be able to type in search field. How can i disable keyboard?
Upvotes: 0
Views: 1074
Reputation: 209319
If you want to disable all user input (keyboard, mouse, etc) to the WebView
, you can call
webView.setDisable(true);
If you only want to block keyboard input (so you allow mouse input, etc), add an event filter that consumes keyboard events:
webView.addEventFilter(KeyEvent.ANY, KeyEvent::consume);
Note that this doesn't prevent the user from (for example) searching on google as they can use the mouse to paste text into text fields, etc.
Upvotes: 1