int divLoc = splitPane.getDividerLocation(); int valLoc = validLocation(divLoc); if (divLoc != valLoc) splitPane.setDividerLocation(valLoc);
  public void paint(Graphics g, JComponent jc)  {    // Make sure that the location is valid    int divLoc = splitPane.getDividerLocation();    int valLoc = validLocation(divLoc);    if (divLoc != valLoc)      splitPane.setDividerLocation(valLoc);  }