Package java.awt

Examples of java.awt.GradientPaint


   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness
  {
    GradientPaint gp = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue);
    harness.check(gp.getTransparency(), Transparency.OPAQUE);
    gp = new GradientPaint(1.0f, 2.0f, new Color(1, 2, 3, 4), 3.0f, 4.0f, Color.blue);
    harness.check(gp.getTransparency(), Transparency.TRANSLUCENT);
    gp = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, new Color(1, 2, 3, 4));
    harness.check(gp.getTransparency(), Transparency.TRANSLUCENT);
  }
View Full Code Here


   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)  
  {
    GradientPaint gp = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue);
    harness.check(gp.getColor2(), Color.blue);
  }
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)  
  {
    GradientPaint gp = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue);
    harness.check(gp.getColor1(), Color.red);
  }
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness
  {
    GradientPaint gp = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue);
    Point2D p2 = gp.getPoint2();
    harness.check(p2.getX(), 3.0);
    harness.check(p2.getY(), 4.0);
    // check that p2 has no connection to gp
    p2.setLocation(5.0, 6.0);
    Point2D pp = gp.getPoint2();
    harness.check(pp.getX(), 3.0);
    harness.check(pp.getY(), 4.0);
  }
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness
  {
    GradientPaint gp1 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue, false);
    GradientPaint gp2 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue, true);
    harness.check(!gp1.isCyclic());
    harness.check(gp2.isCyclic());
  }
View Full Code Here

            dim.width,
            dim.height);
      int gradStart = 0;
      int gradEnd = gradientHeight;
      Color alternateColor = new Color(dataToStore.headerGradientColor.intValue());
            GradientPaint gragient;
            if (horizontal) {
                gragient = new GradientPaint(gradStart, 0, baseColor, gradEnd, 0, alternateColor);
            } else {
                gragient = new GradientPaint(0, gradStart, baseColor, 0, gradEnd, alternateColor);
            }
      g2d.setPaint(gragient);
      g2d.fill(rect);
    }
  }
View Full Code Here

    g2.translate( x, y );
 
    if( (width != recentWidth) || (height != recentHeight) ) {
      if( height != recentHeight ) {
        final int hh  = height >> 1;
        pntOutlineT    = new GradientPaint( 0, 0, colrDark, 0, hh, colrClearD );
        pntOutlineB    = new GradientPaint( 0, hh, colrClearL, 0, height - 2, colrLight );
        pntInline    = new GradientPaint( 0, 0, colrDark2, 0, hh, colrClearD );
      }
     
      final RectangularShape  r  = new RoundRectangle2D.Float( 0.5f, 0, width - 1, height, diameter, diameter );
      final RectangularShape  r2  = new RoundRectangle2D.Float( 0.5f, 0, width - 2, height - 1, diameter, diameter );
      final Area        a  = new Area( r );
View Full Code Here

        }

        graphics.setStroke(new BasicStroke());

        // Paint the background
        graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
            width / 2f, height / 2f, backgroundColor));
        graphics.fillRect(0, 0, width, height);

        // Paint the border
        graphics.setPaint(borderColor);
View Full Code Here

        int buttonX = upButton.getX();
        int buttonWidth = upButton.getWidth();
        int buttonHeight = upButton.getHeight();

        graphics.setPaint(new GradientPaint(buttonX + buttonWidth / 2, 0, buttonBevelColor,
            buttonX + buttonWidth / 2, buttonHeight, buttonBackgroundColor));
        graphics.fillRect(buttonX, 0, buttonWidth, height);

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

        @Override
        public void paint(Graphics2D graphics) {
            int width = getWidth();
            int height = getHeight();

            graphics.setPaint(new GradientPaint(width / 2f, 0, buttonBevelColor,
                width / 2f, height, buttonBackgroundColor));
            graphics.fillRect(0, 0, width, height);

            float alpha = (highlighted || dragOffset != null) ? 0.25f : 0.0f;
            graphics.setPaint(new Color(0, 0, 0, alpha));
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.