Here you can find the source of renderGraphics(JComponent c, Graphics g)
public static void renderGraphics(JComponent c, Graphics g)
//package com.java2s; import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; public class Main { public static void renderGraphics(JComponent c, Graphics g) { GradientPaint gp = new GradientPaint(0, 0, new Color(240, 240, 240), 0, c.getHeight() / 2, new Color(230, 230, 255), true); ((Graphics2D) g).setPaint(gp); g.fillRect(0, 0, c.getWidth(), c.getHeight()); }// www. j av a2 s . c o m }