Example usage for java.awt GradientPaint getTransparency

List of usage examples for java.awt GradientPaint getTransparency

Introduction

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

Prototype

public int getTransparency() 

Source Link

Document

Returns the transparency mode for this GradientPaint .

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);

    System.out.println(gp1.getTransparency());
    g2d.setPaint(gp1);//from   www . j  a va 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);

    gp1.createContext(ColorModel.getRGBdefault(), new Rectangle(0, 0, 30, 40), new Rectangle(0, 0, 30, 40),
            new AffineTransform(), null);

    System.out.println(gp1.getTransparency());
    g2d.setPaint(gp1);//from w w w  .  j  a  v a2s . c o m
    g2d.fillRect(20, 20, 300, 40);

}