Here you can find the source of suppressBorders(JComponent comp)
public static void suppressBorders(JComponent comp)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.awt.Component; import java.awt.Container; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JToggleButton; public class Main { /**/* w ww. j a va2s . com*/ * Browse the whole hierarchy of components and nullify their * borders. */ public static void suppressBorders(Container container) { for (Component comp : container.getComponents()) { if (comp instanceof JComponent) { suppressBorders((JComponent) comp); } else if (comp instanceof Container) { suppressBorders((Container) comp); } } } /** * Nullify the border of this JComponent, as well as its * subcomponents. */ public static void suppressBorders(JComponent comp) { if (!(comp instanceof JButton) && !(comp instanceof JToggleButton)) { comp.setBorder(null); } suppressBorders((Container) comp); } }