Here you can find the source of renderByLineGraphics(JComponent c, Graphics g)
public static void renderByLineGraphics(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 renderByLineGraphics(JComponent c, Graphics g) { int colorI = 0; for (int i = 0; i < c.getHeight(); i++) { GradientPaint gp = new GradientPaint(0, 0, new Color(200, 200, colorI), c.getWidth(), i, new Color(200, 200, colorI + 1), true); ((Graphics2D) g).setPaint(gp); g.fillRect(0, i, c.getWidth(), i); if (colorI < 254) colorI++;/*from w w w .j a va2 s.c om*/ } } }