Reputation: 13
I have an application which has menubar.
This menubar has a menuitem with the Ctrl+H accelerator.
The problem is that when a TextField (or PasswordField) is focused, it catch the Ctrl+H event to make a backward deletion.
Does someone have a trick to prevent the textfield from catching this event?
Upvotes: 0
Views: 325
Reputation: 272
try this code....it will prevent TextBox from backward remove(Ctrl+H).
txtBox.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent t) {
if(t.getCode()==KeyCode.H && t.isControlDown() )
{
t.consume();
}
}});
Upvotes: 1