code: public void setOrientation (int orientation)
      {
          GroupLayout gl = (orientation == HORIZONTAL) ?
              (GroupLayout)new HGroupLayout() : new VGroupLayout();
          gl.setPolicy(GroupLayout.EQUALIZE);
          setLayout(gl);
      }
docs: Sets the orientation of the box (either {@link #HORIZONTAL} or
  {@link #VERTICAL}.