if (location < getMinimumDividerLocation(splitPane)) return getMinimumDividerLocation(splitPane); if (location > getMaximumDividerLocation(splitPane)) return getMaximumDividerLocation(splitPane);
int min = getMinimumDividerLocation(splitPane); int max = getMaximumDividerLocation(splitPane); if (min > 0 && location < min) return min; if (max > 0 && location > max) return max;
  private int validLocation(int location)  {    if (location < getMinimumDividerLocation(splitPane))      return getMinimumDividerLocation(splitPane);    if (location > getMaximumDividerLocation(splitPane))      return getMaximumDividerLocation(splitPane);    return location;  }