Java Graphics Draw renderByLineGraphics(JComponent c, Graphics g)

Here you can find the source of renderByLineGraphics(JComponent c, Graphics g)

Description

render By Line Graphics

License

Open Source License

Declaration

public static void renderByLineGraphics(JComponent c, Graphics g) 

Method Source Code


//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*/
        }
    }
}

Related

  1. paintSprite(Graphics g, int x, int y, int[][] sprite, Color[] colors)
  2. prepareGraphics(Graphics g)
  3. printAll(java.awt.Graphics2D g2, java.awt.Component component)
  4. raiseOval(Graphics2D g2, Rectangle r, Color foreColor)
  5. raiseRect(Graphics2D g2, Rectangle r, Color foreColor)
  6. renderGraphics(JComponent c, Graphics g)
  7. useAntiAliasing(Graphics2D g)