Here you can find the source of repaintBorder(JComponent component)
public static void repaintBorder(JComponent component)
//package com.java2s; /*//from ww w.j a v a 2 s . c o m * @(#)QuaquaUtilities.java * * Copyright (c) 2003-2010 Werner Randelshofer, Immensee, Switzerland. * All rights reserved. * * You may not use, copy or modify this file, except in compliance with the * license agreement you entered into with Werner Randelshofer. * For details see accompanying license terms. */ 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, insets.top, insets.left, h - insets.bottom - insets.top); c.repaint(0, h - insets.bottom, w, insets.bottom); c.repaint(w - insets.right, insets.top, insets.right, h - insets.bottom - insets.top); } } }