code: public static void addDebugBorders (JPanel panel)
      {
          Color bcolor = new Color(_rando.nextInt(256), _rando.nextInt(256), _rando.nextInt(256));
          panel.setBorder(BorderFactory.createLineBorder(bcolor));
  
          for (int ii = 0; ii < panel.getComponentCount(); ii++) {
              Object child = panel.getComponent(ii);
              if (child instanceof JPanel) {
                  addDebugBorders((JPanel)child);
              }
          }
      }
docs: Adds a one pixel border of random color to this and all panels contained in this panel's
  child hierarchy.