Package java.awt

Examples of java.awt.LinearGradientPaint


  int width = 100;
  int height = 100;
  Color color1 = Colors.White.color(0.5f);
  Color color2 = Colors.Gray.color(0.5f);

  LinearGradientPaint gradientPaint =
      new LinearGradientPaint(0.0f, 0.0f, width, height,
                              new float[]{0.0f, 1.0f},
                              new Color[]{color1, color2});
  MattePainter mattePainter = new MattePainter(gradientPaint);
  return mattePainter;
}
View Full Code Here


                                Color[] colors = { titleBackgroundGradientStart,
                                                titleBackgroundGradientEnd };

                                float[] fractions = { 0.0f, 1.0f };

                                LinearGradientPaint gradient = new LinearGradientPaint(group
                                                .getWidth() / 2, 0.0f, group.getWidth() / 2,
                                                getTitleHeight(group), fractions, colors);

                                ((Graphics2D) g).setPaint(gradient);
View Full Code Here

    }
   
    public void setGradient(MultipleGradientPaint grad) {
        MultipleGradientPaint old = getGradient();
        if(grad instanceof LinearGradientPaint) {
            LinearGradientPaint paint = (LinearGradientPaint)grad;
            this.start = paint.getStartPoint();
            this.end = paint.getEndPoint();
        } else {
            RadialGradientPaint paint = (RadialGradientPaint)grad;
            this.start = paint.getCenterPoint();
            this.end = new Point2D.Double(start.getX(),start.getY()+paint.getRadius());
        }
        this.gradient = grad;
        firePropertyChange("gradient", old, getGradient());
        repaint();
    }
View Full Code Here

            paint = new RadialGradientPaint(
            start, (float)start.distance(end),start,
            fractions, colors, cycle, MultipleGradientPaint.ColorSpaceType.SRGB, null
            );
        } else {
            paint = new LinearGradientPaint(
            (float)start.getX(),
            (float)start.getY(),
            (float)end.getX(),
            (float)end.getY(),
            fractions,colors,cycle);           
View Full Code Here

        g.fill(rect);

        // fill in the gradient
        Point2D start = new Point2D.Float(0,0);
        Point2D end = new Point2D.Float(track_width,0);
        MultipleGradientPaint paint = new LinearGradientPaint(
                (float)start.getX(),
                (float)start.getY(),
                (float)end.getX(),
                (float)end.getY(),
                fractions,colors);
View Full Code Here

        Color[] colors = gp.getColors();

        // fill in the gradient
        Point2D start = new Point2D.Float(0, 0);
        Point2D end = new Point2D.Float((float) length, 0);
        MultipleGradientPaint paint = new LinearGradientPaint(
                (float) start.getX(),
                (float) start.getY(),
                (float) end.getX(),
                (float) end.getY(),
                fractions, colors);
View Full Code Here

       
        gradient = new GradientPaint(new Point(30, 30), Color.RED,
                new Point(80, 80), Color.GREEN);
        node.add(createInfoNode("single stop, diag", new MattePainter(gradient)));
       
        gradient = new LinearGradientPaint(new Point(30,30), new Point(80,30),
                new float[] {0f, 0.5f, 1f},
                new Color[] {Color.RED, Color.GREEN, Color.BLUE} );
        node.add(createInfoNode("multi stop horiz", new MattePainter(gradient)));
       
        gradient = new LinearGradientPaint(new Point(30,30), new Point(30,80),
                new float[] {0f, 0.5f, 1f},
                new Color[] {Color.RED, Color.GREEN, Color.BLUE} );
        node.add(createInfoNode("multi stop vert", new MattePainter(gradient)));
       
        gradient = new LinearGradientPaint(new Point(30,30), new Point(30,80),
                new float[] {0f, 0.5f, 1f},
                new Color[] {Color.RED, Color.GREEN, Color.BLUE} );
        node.add(createInfoNode("multi stop diag", new MattePainter(gradient)));
       
        return node;
View Full Code Here

        Rectangle2D bounds = s.getBounds2D();
        float       minY   = (float) bounds.getMinY();
        float       maxY   = (float) bounds.getMaxY();
        float       midX   = (float) bounds.getCenterX();

        return new LinearGradientPaint(midX, minY, midX, maxY, (new float[] { 0f, 1f }), new Color[] { innerShadow.top, transparentColor });
    }
View Full Code Here

        Rectangle2D bounds = s.getBounds2D();
        float       minX   = (float) bounds.getMinX();
        float       maxX   = (float) bounds.getMaxX();
        float       midY   = (float) bounds.getCenterY();

        return new LinearGradientPaint(minX, midY, maxX, midY, (new float[] { 0f, 1f }),
                                       new Color[] { innerShadow.bottom, transparentColor });
    }
View Full Code Here

        Rectangle2D bounds = s.getBounds2D();
        float       minX   = (float) bounds.getMinX() - 1;
        float       maxX   = (float) bounds.getMaxX() - 1;
        float       midY   = (float) bounds.getCenterY();

        return new LinearGradientPaint(minX, midY, maxX, midY, (new float[] { 0f, 1f }),
                                       new Color[] { transparentColor, innerShadow.bottom });
    }
View Full Code Here

TOP

Related Classes of java.awt.LinearGradientPaint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.