Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default Alternating Transparency Based on Double Variable

    Hi, I'm trying to change transparency with a double value. I've been using:
    Java Code:
    g2d.setComposite(java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.SRC_OVER, 0.1f));
    Although, I can't figure out how to get it to work. Any explanation, alternate way of doing this, and any links on this are appreciated.

    Thanks.
    Last edited by YellowPainting; 11-05-2010 at 09:29 AM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,406
    Rep Power
    20

  3. #3
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default

    Thanks it helped. Should have looked there, lol.


    Java Code:
        public void setTransparency(int length)
        {
            double num = (double)length/100.0;
            if (num > 1.0)
            {
                num = 1.0;
            }
            String temp = Double.toString(num);
            float test = Float.valueOf(temp).floatValue();
            g2d.setComposite(java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.SRC_OVER, test));
        }

Similar Threads

  1. Alternating Sum
    By ScaryJello in forum New To Java
    Replies: 6
    Last Post: 10-13-2009, 09:18 AM
  2. Double Variable Class
    By hypes057 in forum New To Java
    Replies: 9
    Last Post: 09-06-2009, 02:06 PM
  3. variable double problem
    By DarkoDrljaca in forum New To Java
    Replies: 5
    Last Post: 03-02-2009, 08:00 AM
  4. Replies: 3
    Last Post: 11-24-2008, 07:01 PM
  5. Replies: 3
    Last Post: 01-19-2008, 08:38 AM

Posting Permissions

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