PressAnyKeyState() { getInput().addEventHandler(KeyEvent.KEY_PRESSED, e -> { if (Input.isIllegal(e.getCode())) return; boolean rebound = FXGL.getInput().rebind(actionContext, e.getCode(), InputModifier.from(e)); if (rebound) FXGL.getStateMachine().popState(); }); getInput().addEventHandler(MouseEvent.MOUSE_PRESSED, e -> { boolean rebound = FXGL.getInput().rebind(actionContext, e.getButton(), InputModifier.from(e)); if (rebound) FXGL.getStateMachine().popState(); }); Rectangle rect = new Rectangle(250, 100); rect.setStroke(Color.color(0.85, 0.9, 0.9, 0.95)); rect.setStrokeWidth(10); rect.setArcWidth(15); rect.setArcHeight(15); Text text = getUIFactory().newText(getLocalizedString("menu.pressAnyKey"), 24); StackPane pane = new StackPane(rect, text); pane.setTranslateX(FXGL.getAppWidth() / 2 - 125); pane.setTranslateY(FXGL.getAppHeight() / 2 - 50); getChildren().add(pane); } }