Here you can find the source of addDebugBorders(JPanel panel)
public static void addDebugBorders(JPanel panel)
//package com.java2s; import java.awt.Color; import java.util.Random; import javax.swing.BorderFactory; import javax.swing.JPanel; public class Main { /** Used by {@link #addDebugBorders}. */ protected static final Random _rando = new Random(); /**/*ww w. j a va 2s. c o m*/ * Adds a one pixel border of random color to this and all panels contained in this panel's * child hierarchy. */ 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); } } } }