code: private void ensureCurrentLayout() {
          if (!tabPane.isValid()) {
              tabPane.validate();
          }
  
          /*
           * If tabPane doesn't have a peer yet, the validate() call will silently
           * fail. We handle that by forcing a layout if tabPane is still invalid.
           * See bug 4237677.
           */
          if (!tabPane.isValid()) {
              TabbedPaneLayout layout = (TabbedPaneLayout) tabPane.getLayout();
  
              layout.calculateLayoutInfo();
          }
      }
docs: Make sure we have laid out the pane with the current layout.