Here you can find the source of repaintBorder(JComponent component)
public static void repaintBorder(JComponent component)
//package com.java2s; /*// ww w. ja v a2 s . com * @(#)QuaquaUtilities.java 3.1 2006-09-04 * * Copyright (c) 2003-2006 Werner Randelshofer * Staldenmattweg 2, Immensee, CH-6405, Switzerland. * All rights reserved. * * This software is the confidential and proprietary information of * Werner Randelshofer. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Werner Randelshofer. */ import java.awt.*; import javax.swing.*; import javax.swing.border.*; public class Main { public static void repaintBorder(JComponent component) { JComponent c = component; Border border = null; Container container = component.getParent(); if (container instanceof JViewport) { c = (JComponent) container.getParent(); if (c != null) { border = c.getBorder(); } } if (border == null) { border = component.getBorder(); c = component; } if (border != null && c != null) { int w = c.getWidth(); int h = c.getHeight(); Insets insets = c.getInsets(); c.repaint(0, 0, w, insets.top); c.repaint(0, 0, insets.left, h); c.repaint(0, h - insets.bottom, w, insets.bottom); c.repaint(w - insets.right, 0, insets.right, h); } } }