Example usage for java.awt GradientPaint GradientPaint

List of usage examples for java.awt GradientPaint GradientPaint

Introduction

In this page you can find the example usage for java.awt GradientPaint GradientPaint.

Prototype

public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2, boolean cyclic) 

Source Link

Document

Constructs either a cyclic or acyclic GradientPaint object depending on the boolean parameter.

Usage

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true);

    g2d.setPaint(gp1);// ww w .  j av  a  2  s .c  o m
    g2d.fillRect(20, 20, 300, 40);

}

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true);

    System.out.println(gp1.getColor2());
    g2d.setPaint(gp1);//from  w  w  w .  j av  a2s .  c om
    g2d.fillRect(20, 20, 300, 40);

}

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true);

    System.out.println(gp1.getTransparency());
    g2d.setPaint(gp1);/*ww w . j av  a2s  .  co m*/
    g2d.fillRect(20, 20, 300, 40);

}

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true);

    System.out.println(gp1.getColor1());
    g2d.setPaint(gp1);/* w  w  w  .j  a  v  a 2 s  .  co  m*/
    g2d.fillRect(20, 20, 300, 40);

}

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true);

    System.out.println(gp1.getPoint2());
    g2d.setPaint(gp1);/*  w w  w.  jav a 2  s  . c o m*/
    g2d.fillRect(20, 20, 300, 40);

}

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true);

    System.out.println(gp1.getPoint1());
    g2d.setPaint(gp1);// w  w w. j  av a2  s . c  o  m
    g2d.fillRect(20, 20, 300, 40);

}

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true);

    System.out.println(gp1.isCyclic());
    g2d.setPaint(gp1);/*from   w  ww  .j  ava  2 s . c o m*/
    g2d.fillRect(20, 20, 300, 40);

}

From source file:GradientsLine.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 25, Color.green, 2, 2, Color.black, true);

    g2d.setPaint(gp1);/*  w  ww.  j a  v  a2  s .com*/
    g2d.fillRect(20, 140, 300, 40);

}

From source file:GradientsMiddle.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(0, 0, Color.orange, 0, 20, Color.black, true);

    g2d.setPaint(gp1);//from w  w  w .  ja  va2 s  .  c om
    g2d.fillRect(20, 260, 300, 40);

}

From source file:GradientsVertical.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(25, 25, Color.blue, 15, 25, Color.black, true);

    g2d.setPaint(gp1);//from  ww w.j  av  a2 s  . c  o m
    g2d.fillRect(20, 200, 300, 40);

}