Results 1 to 3 of 3
  1. #1
    rtc1 is offline Member
    Join Date
    May 2010
    Location
    northern california
    Posts
    7
    Rep Power
    0

    Default Path Gradient Paint in Java 2D?

    I have used PathGradientPaint in .NET and would like to find a way to replicate it in Java2D.

    Specifically, I'm trying to replicate the gradual shading of the button at the URL below which is easy in .NET:

    http://www.vgdotnet.com/articles/cal...gle_button.png

    I have searched the web via Google to no avail. I have created semi-transparent inner rectangles and then blurred and alpha-composited them on top of the background but this is just not as effective. I also tried using RadialGradientPaint for the corners and GradientPaint for the straight sides, but it just didn't look very good.

    I could write my own Paint and PaintContext to do this, but would prefer not to reinvent the wheel.

    Thanks in advance,
    Rick
    Last edited by rtc1; 05-07-2010 at 07:30 PM. Reason: Added additional information

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default

    Does a GradientPaint object help you a bit?

    kind regards,

    Jos

  3. #3
    rtc1 is offline Member
    Join Date
    May 2010
    Location
    northern california
    Posts
    7
    Rep Power
    0

    Default

    Jos, sorry, but not that I know of.

    Neither does RadialGradientPaint. Here is a clock I coded recently in Java 2D that uses GradientPaint and RadialGradientPaint, so I do know about these classes.

    http://sites.google.com/site/rickcre...lockMedium.png

    If there is a clever way to use GradientPaint that I haven't thought of, let me know.

    Thanks for your reply.

    Rick

Similar Threads

  1. Gradient of an image
    By Sapan in forum Forum Lobby
    Replies: 1
    Last Post: 04-08-2011, 03:03 PM
  2. Java Paint Method?
    By leapinlizard in forum Java 2D
    Replies: 2
    Last Post: 02-11-2010, 07:01 PM
  3. JComponent gradient background
    By snipered in forum AWT / Swing
    Replies: 0
    Last Post: 12-30-2008, 12:38 AM
  4. CLabel Gradient Background
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-11-2008, 04:39 PM
  5. Color gradient
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-21-2008, 08:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •