Im trying to build a key rebinding for my game. Problem is. I cant figure out a good way to do it. I have tried 2 ways, with button and with label. Both have the same problem. Focus. Id like to make it so that while button is focused, focus traversable is disable so that no matter what i press the focus stays on the button. After i have pressed a key on keyboard the focus should be released, so that if i press a key again, nothing will happen.

Keyboard class is from lwjgl cause the main controls are handled by lwjgl. Only the rebinding menu is done with javaFX.

Here are my 2 ideas.
Java FX Code:
final Label Left = new Label ("Left");
		box.add(Left,0,1);
		
		final Button left = new Button(Keyboard.getKeyName(playerRotateLeft));
		left.setOnMouseClicked(new EventHandler<MouseEvent>(){
			public void handle(MouseEvent e){
				left.setOnKeyPressed(new EventHandler<KeyEvent>(){
					public void handle(KeyEvent k){
						playerRotateLeft = Keyboard.getKeyIndex(k.getCode().getName().toUpperCase());
						left.setText(k.getCode().getName().toUpperCase());
					}
				});
			}
		});
		box.add(left, 2, 1);
		
		final Label Right = new Label ("Right");
		box.add(Right,0,2);
		
		final Label right = new Label(Keyboard.getKeyName(playerRotateRight));
		right.setOnMouseClicked(new EventHandler<MouseEvent>(){
			public void handle(MouseEvent e){
				right.setOnKeyPressed(new EventHandler<KeyEvent>(){
					public void handle(KeyEvent k){
						playerRotateRight = Keyboard.getKeyIndex(k.getCode().getName().toUpperCase());
						right.setText(k.getCode().getName().toUpperCase());
					}
				});
			}
		});
		box.add(right, 2, 2);