Here you can find the source of drawBorders(final JPanel panel)
Parameter | Description |
---|---|
panel | the panel to draw borders on |
public static void drawBorders(final JPanel panel)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import java.awt.Component; import javax.swing.BorderFactory; import javax.swing.JPanel; public class Main { /**/*from ww w. j a v a 2 s. co m*/ * Draw borders around the given {@link JPanel} and all descendants. * @param panel the panel to draw borders on */ public static void drawBorders(final JPanel panel) { panel.setBorder(BorderFactory.createLineBorder(Color.RED)); final Component[] components = panel.getComponents(); for (final Component comp : components) { if (comp instanceof JPanel) { drawBorders((JPanel) comp); } } panel.revalidate(); } }