Example usage for java.awt LinearGradientPaint getColors

List of usage examples for java.awt LinearGradientPaint getColors

Introduction

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

Prototype

public final Color[] getColors() 

Source Link

Document

Returns a copy of the array of colors used by this gradient.

Usage

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.legend.CustomLegendGraphic.java

private static LinearGradientPaint getTranslatedLinearGradientPaint(LinearGradientPaint gradient,
        Point2D startPoint, Point2D endPoint, boolean vertical) {
    if (vertical) {
        return new LinearGradientPaint(0f, (float) startPoint.getY(), 0f, (float) endPoint.getY(),
                gradient.getFractions(), gradient.getColors());
    } else {// w  w  w . ja  va2  s . c  om
        return new LinearGradientPaint((float) startPoint.getX(), 0f, (float) endPoint.getX(), 0f,
                gradient.getFractions(), gradient.getColors());
    }
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.legend.SmartLegendTitle.java

public static Paint transformLinearGradient(LinearGradientPaint paint, Shape target) {
    Rectangle2D bounds = target.getBounds2D();
    float left = (float) bounds.getMinX();
    float right = (float) bounds.getMaxX();
    LinearGradientPaint newPaint = new LinearGradientPaint(left, 0, right, 0, paint.getFractions(),
            paint.getColors());
    return newPaint;
}