Package java.awt

Examples of java.awt.GradientPaint


        public void paint(Graphics graphics) {
            Graphics2D g = (Graphics2D)graphics.create();
            // Workaround for OSX since we only get automatic clipping
            // on the content pane and below
            g.setClip(getMask());
            g.setPaint(new GradientPaint(0, getHeight()/2, new Color(0,0,0,0), getWidth(), getHeight()/2, new Color(0,0,0,255)));
            g.fillRect(0, 0, getWidth(), getHeight());
            g.dispose();
        }
View Full Code Here


            }
            if (g instanceof Graphics2D)
            {
                final Graphics2D gg = (Graphics2D) g;
                int gh = 1;
                gg.setPaint(new GradientPaint(new Point2D.Float(0.0F, 0.0F),
                        new Color(553648127, true),
                        new Point2D.Float(0.0F, gh), new Color(0, true)));
                gg.fillRect(0, 0, w, gh);
               
                gh = h;
                gg.setPaint(new GradientPaint(new Point2D.Float(0.0F, 0.0F),
                        new Color(0, true), new Point2D.Float(0.0F, gh),
                        new Color(1610612736, true)));
                gg.fillRect(0, 0, w, gh);
            }
            g.dispose();
View Full Code Here

        **/
        public void draw(Graphics2D g2, Point p)
        {
            int x = p.x - 25;
            int y = p.y - 25;
            GradientPaint gradient = new GradientPaint(
                x, y, Color.BLUE, x + 50, y, Color.WHITE);
            g2.setPaint(gradient);
            g2.fill(new Rectangle2D.Double(x, y, 50, 50));
            BasicStroke wideStroke = new BasicStroke(2.0f);
            g2.setColor(Color.black);
View Full Code Here

            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);

            switch(tabOrientation) {
                case HORIZONTAL: {
                    graphics.setPaint(new GradientPaint(width / 2f, 0, buttonBevelColor,
                        width / 2f, height / 2f, backgroundColor));
                    graphics.fill(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height - 1 + buttonCornerRadius,
                        buttonCornerRadius, buttonCornerRadius));
                    break;
                }

                case VERTICAL: {
                    graphics.setPaint(new GradientPaint(0, height / 2f, buttonBevelColor,
                        width / 2f, height / 2f, backgroundColor));
                    graphics.fill(new RoundRectangle2D.Double(0.5, 0.5, width - 1 + buttonCornerRadius, height - 1,
                        buttonCornerRadius, buttonCornerRadius));
                    break;
                }
View Full Code Here

        TerraTheme theme = (TerraTheme)Theme.getTheme();

        Color backgroundColor = theme.getColor(9);
        Color brightBackgroundColor = TerraTheme.brighten(backgroundColor);

        GradientPaint backgroundPaint;
        if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
            backgroundPaint = new GradientPaint(0, 1, backgroundColor,
                0, DEFAULT_THICKNESS - 2, brightBackgroundColor);
        } else {
            backgroundPaint = new GradientPaint(1, 0, backgroundColor,
                DEFAULT_THICKNESS - 2, 0, brightBackgroundColor);
        }

        setBackgroundPaint(backgroundPaint);
View Full Code Here

            // Paint the background
            Color gradientStartColor = pressed ? backgroundColor : brightBackgroundColor;
            Color gradientEndColor = pressed ? brightBackgroundColor : backgroundColor;

            if (orientation == Orientation.HORIZONTAL) {
                graphics.setPaint(new GradientPaint(0, 1, gradientStartColor,
                    0, height - 2, gradientEndColor));
            } else {
                graphics.setPaint(new GradientPaint(1, 0, gradientStartColor,
                    width - 2, 0, gradientEndColor));
            }

            graphics.fillRect(1, 1, width - 2, height - 2);
View Full Code Here

            Color brightBackgroundColor = TerraTheme.brighten(backgroundColor);
            Color darkBackgroundColor = TerraTheme.darken(backgroundColor);

            if (orientation == Orientation.HORIZONTAL) {
                graphics.setPaint(new GradientPaint(0, 1, brightBackgroundColor,
                    0, height - 2, backgroundColor));
            } else {
                graphics.setPaint(new GradientPaint(1, 0, brightBackgroundColor,
                    width - 2, 0, backgroundColor));
            }

            graphics.fillRect(1, 1, width - 2, height - 2);
View Full Code Here

        int titleBarHeight = titleBarTablePane.getHeight();

        graphics.setPaint(titleBarBorderColor);
        GraphicsUtilities.drawLine(graphics, 0, 1 + titleBarHeight, width, Orientation.HORIZONTAL);

        graphics.setPaint(new GradientPaint(titleBarX + titleBarWidth / 2, titleBarY, titleBarBevelColor,
            titleBarX + titleBarWidth / 2, titleBarY + titleBarHeight, titleBarBackgroundColor));
        graphics.fillRect(titleBarX, titleBarY, titleBarWidth, titleBarHeight);

        graphics.setPaint(borderColor);
        GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
View Full Code Here

     
         compassPlot.setSeriesNeedle(5);
         compassPlot.setSeriesPaint(0, Color.white);
         compassPlot.setSeriesOutlinePaint(0, Color.white);
         compassPlot.setRosePaint(Color.green);
         compassPlot.setRosePaint(new GradientPaint(1.0f, 2.0f, Color.blue,3.0f, 4.0f, Color.yellow));
         compassPlot.setRoseHighlightPaint(Color.gray);
         compassPlot.setRoseCenterPaint(Color.black);
         compassPlot.setDrawBorder(true);

     
View Full Code Here

            setColor((Color)paint);
        } else {
            this.paint = paint;
            nativeBrush = false;
            if (paint instanceof GradientPaint) {
                GradientPaint p = (GradientPaint)paint;
                if (!p.isCyclic()) {
                    return;
                }
                Color c1 = p.getColor1();
                Color c2 = p.getColor2();
                Point2D p1 = transform.transform(p.getPoint1(), null);
                Point2D p2 = transform.transform(p.getPoint2(), null);
                setLinearGradientBrush(gi, (int)Math.round(p1.getX()), (int)Math.round(p1.getY()), c1.getRed(), c1.getGreen(), c1.getBlue(), c1.getAlpha(),
                                           (int)Math.round(p2.getX()), (int)Math.round(p2.getY()), c2.getRed(), c2.getGreen(), c2.getBlue(), c2.getAlpha(), p.isCyclic());
                nativeBrush = true;
            }
            setStroke(getStroke());
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.GradientPaint

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.