Examples of GradientPaint


Examples of java.awt.GradientPaint

            super.paint(g);

            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

            GradientPaint gp = new GradientPaint(180.0f, 280.0f, new Color(255, 255, 255, 255), 250.0f, 380.0f, new Color(255, 255, 0, 0));
            g2.setPaint(gp);
            for(int i = 0; i < 3; i ++ ) {
                g2.drawOval(150, 280, 100, 100);
                g2.fillOval(150, 280, 100, 100);
                g2.translate(120, 20);
View Full Code Here

Examples of java.awt.GradientPaint

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

Examples of java.awt.GradientPaint

        **/
        public void draw(Graphics2D g2, Point p)
        {
            int x = p.x - 25;
            int y = p.y - 25;
            GradientPaint gradient = new GradientPaint(
                x, y, Color.YELLOW, x + 50, y, Color.WHITE);
            g2.setPaint(gradient);
            int[] xcoords = { x + 10, x, x + 50, x + 40 };
            int[] ycoords = { y, y + 50, y + 50, y };
            GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, xcoords.length);
View Full Code Here

Examples of java.awt.GradientPaint

        }

        protected void paintComponent(Graphics graphics) {
            //super.paintComponent(graphics);
            // paint background
            GradientPaint gradientPaint = new GradientPaint(0, 0, getBackground().darker(), 0, getHeight()/2.0f, getBackground().brighter(), true);
            Color color = graphics.getColor();
            final Graphics2D graphics2D = (Graphics2D)graphics;
            graphics2D.setPaint(gradientPaint);
            graphics2D.fillRect(0, 0, getWidth(), getHeight());
            graphics2D.setColor(color);
View Full Code Here

Examples of java.awt.GradientPaint

            int width = getWidth();
            int height = getHeight();

            Graphics2D g2 = (Graphics2D) g;
            Paint storedPaint = g2.getPaint();
            g2.setPaint(new GradientPaint(0, 0, getBackground(), width, 0,
                    control));
            g2.fillRect(0, 0, width, height);
            g2.setPaint(storedPaint);
        }
View Full Code Here

Examples of java.awt.GradientPaint

                int h = this.getSize().height;
                int w = this.getSize().width;

                //g2d.setPaint(new GradientPaint(0,0,Color.WHITE, w, h, new
                // Color(175,175,255)));
                g2d.setPaint(new GradientPaint(0, 0, /*super.getBackground()*/ new Color(227,236,217), w,
                        0, super.getBackground().brighter()));
                g2d.fillRect(0, 0, w, h);
            }
        };
        menuBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
View Full Code Here

Examples of java.awt.GradientPaint

        Graphics2D g2d = (Graphics2D) g;
        int h = this.getSize().height;
        int w = this.getSize().width;

        g2d.setPaint(new GradientPaint(0, 0, super.getBackground(), w, 0, super
                .getBackground().brighter()));
        g2d.fillRect(0, 0, w, h);
    }
View Full Code Here

Examples of java.awt.GradientPaint

        return horizontal;
    }

    protected void drawGradient(Graphics2D g2d, Shape shape, BiColor colors, int height) {
        if (colors != null) {
            GradientPaint gragient = new GradientPaint(0, 0, colors.getTopColor(), 0, height, colors.getBottomColor());
            g2d.setPaint(gragient);
            g2d.fill(shape);
        }
    }
View Full Code Here

Examples of java.awt.GradientPaint

                        if (gradMidPt < 0.5)
                            pt1 = pt1.rotatePoint(shape.getGravityCentre(), Math.PI);
                    }
                }//if(angle!=0)

        g.setPaint(new GradientPaint(
              (float)pt1.getX(), (float)pt1.getY(), shape.getGradColStart(),
              (float)pt2.getX(), (float)pt2.getY(), shape.getGradColEnd(),true));
        g.fill(p);
        break;
View Full Code Here

Examples of java.awt.GradientPaint

                final Color c1 = (Color) stream.readObject();
                final float x2 = stream.readFloat();
                final float y2 = stream.readFloat();
                final Color c2 = (Color) stream.readObject();
                final boolean isCyclic = stream.readBoolean();
                result = new GradientPaint(x1, y1, c1, x2, y2, c2, isCyclic);
            }
        }
        return result;

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.