code: private Rectangle extendRect(Rectangle rect, boolean horizontal) {
          if (rect == null) {
              return rect;
          }
  
          if (horizontal) {
              rect.x     = 0;
              rect.width = table.getWidth();
          } else {
              rect.y = 0;
  
              if (table.getRowCount() != 0) {
                  Rectangle lastRect = table.getCellRect(table.getRowCount() - 1, 0, true);
  
                  rect.height = lastRect.y + lastRect.height;
              } else {
                  rect.height = table.getHeight();
              }
          }
  
          return rect;
      }
docs: DOCUMENT ME!
  
  @param  rect       DOCUMENT ME!
  @param  horizontal DOCUMENT ME!
  
  @return DOCUMENT ME!