Results 1 to 2 of 2
  1. #1
    courteous is offline Member
    Join Date
    Jan 2009
    Rep Power

    Red face (Trying to) fill HSB (Hue|Saturation|Brightness) array

    I'm getting
    Java Code:
    ArrayIndexOutOfBoundsException: 0
    when trying to fill the array with Hue values (Saturation and Brightness remain 100%):
    PHP Code:
    private Color[] hsb = new Color[numberOfCircles]; //outside method
    float h=0; //in method
    float raise=(1.f/numberOfCircles);
    for (int i=0; i<stKrogcev; i++) {
        hsb[i]=Color.getHSBColor(h,1.0f,1.0f); //getHSBColor: "Creates a Color object based on the specified values for the HSB color model."

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    Insufficient code. To get better help faster, post a SSCCE. Link: SSCCE : Java Glossary

    It appears that your array is initialized with 0 length i.e. numberOfCircles was zero when you declared it.

    Of course, you may have two different variables with the same name. Or some other bug, who really knows?


Similar Threads

  1. How to Fill Arc in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 11:14 PM
  2. How to Fill a Polygon in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:10 PM
  3. Replies: 0
    Last Post: 04-23-2008, 08:15 PM
  4. Array Fill Test
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 08:45 PM
  5. Replies: 0
    Last Post: 04-14-2008, 08:43 PM

Posting Permissions

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