code: public static void setKeyboardFocus(final Actor actor) {
          if (actor != null && actor.getStage() != null) {
              actor.getStage().setKeyboardFocus(actor);
          }
      }
docs: Null-safe method for setting keyboard focus.
  
  @param actor if is not null and has a stage, will be set as stage's keyboard focused actor.