For loop iteration won't function correctly
Closed
                    
        
                    zlloyd1
    
        
                    Posts
            
                
            10
                
                            Registration date
            Tuesday December 11, 2012
                            Status
            Member
                            Last seen
            February  4, 2013
            
                -
                            Feb  1, 2013 at 06:36 PM
                        
shoaibista Posts 8 Registration date Friday May 24, 2013 Status Member Last seen May 27, 2013 - May 24, 2013 at 11:07 AM
        shoaibista Posts 8 Registration date Friday May 24, 2013 Status Member Last seen May 27, 2013 - May 24, 2013 at 11:07 AM
        Related:         
- For loop iteration won't function correctly
 - Fruity loop for mac - Download - Musical production
 - Mouse not pointing correctly - Guide
 - Mutator function c++ - Guide
 - Network card function - Guide
 - Hard drive function - Guide
 
3 responses
                
        
                    rizvisa1
    
        
                    Posts
            
                
            4478
                
                            Registration date
            Thursday January 28, 2010
                            Status
            Contributor
                            Last seen
            May  5, 2022
            
            
                    766
    
    
                    
Feb 2, 2013 at 02:00 PM
    Feb 2, 2013 at 02:00 PM
                        
                    Just from few lines one reason could be that "colors.get(i)" is object that you may have to explicitly cast as Color
g2d.setColor((Color)colors.get(i));
            g2d.setColor((Color)colors.get(i));
                
        
                    zlloyd1
    
        
                    Posts
            
                
            10
                
                            Registration date
            Tuesday December 11, 2012
                            Status
            Member
                            Last seen
            February  4, 2013
            
                    
Feb 2, 2013 at 07:56 PM
    Feb 2, 2013 at 07:56 PM
                        
                    @rizvisa1,
I figured that as well, but what was confusing me was that this EXACT code ran fine when I compiled and ran it from the command prompt, but had issues when I sposed the code into NetBeans, and that was freaking me out a bit??
            I figured that as well, but what was confusing me was that this EXACT code ran fine when I compiled and ran it from the command prompt, but had issues when I sposed the code into NetBeans, and that was freaking me out a bit??
                
        
                    rizvisa1
    
        
                    Posts
            
                
            4478
                
                            Registration date
            Thursday January 28, 2010
                            Status
            Contributor
                            Last seen
            May  5, 2022
            
            
                    766
    
    
    
Feb 2, 2013 at 08:29 PM
Feb 2, 2013 at 08:29 PM
    could jre be an issue ?
    
    
                
        
                    zlloyd1
    
        
                    Posts
            
                
            10
                
                            Registration date
            Tuesday December 11, 2012
                            Status
            Member
                            Last seen
            February  4, 2013
            
    
Feb 2, 2013 at 09:09 PM
Feb 2, 2013 at 09:09 PM
    I don't believe so, I have the latest run-time environment installed, if I am not mistaken....
    
    
                
        
                    rizvisa1
    
        
                    Posts
            
                
            4478
                
                            Registration date
            Thursday January 28, 2010
                            Status
            Contributor
                            Last seen
            May  5, 2022
            
            
                    766
    
    
    
Feb 2, 2013 at 09:16 PM
Feb 2, 2013 at 09:16 PM
    i would uninstall and re install netbeans, if i were you. You can use eclipse too
    
    
                
        
                    zlloyd1
    
        
                    Posts
            
                
            10
                
                            Registration date
            Tuesday December 11, 2012
                            Status
            Member
                            Last seen
            February  4, 2013
            
    
Feb 3, 2013 at 12:49 AM
Feb 3, 2013 at 12:49 AM
    I( may end up doing that, as soon as I am sure that it is not something wrong with the code!!
    
    
                
        
                    rizvisa1
    
        
                    Posts
            
                
            4478
                
                            Registration date
            Thursday January 28, 2010
                            Status
            Contributor
                            Last seen
            May  5, 2022
            
            
                    766
    
    
    
Feb 3, 2013 at 06:57 AM
Feb 3, 2013 at 06:57 AM
    Since you said code works in desktop and only in IDE it is causing issue, I dont think any thing is wrong with code. Some how IDE is corrupted to some extent or using different java version. See if this helps 
http://forums.netbeans.org/ptopic6210.html
    http://forums.netbeans.org/ptopic6210.html
                
        
                    shoaibista
    
        
                    Posts
            
                
            8
                
                            Registration date
            Friday May 24, 2013
                            Status
            Member
                            Last seen
            May 27, 2013
            
                    
May 24, 2013 at 11:07 AM
    May 24, 2013 at 11:07 AM
                        
                    g2d.setColor((Color)colors.get(i));
Try this.....
This is called downcasting
            Try this.....
This is called downcasting