I am doing a slot machine. I have 3 classes, Symbol,Reel, Gui. How do I display the images in to the Jlabels? I need to populate the ArrayList in the reel class and use the List in the Gui class to display images in the JLabels.
            Asked
            
        
        
            Active
            
        
            Viewed 751 times
        
    1 Answers
1
            
            
        p3.setIcon(listImages.get(2).getIcon());
        satnam
        
- 10,719
 - 5
 - 32
 - 42
 
- 
                    getting the exception now Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.
(ImageIcon.java:217) at framet.Reel. – JohnDoe Nov 23 '16 at 18:06(Reel.java:17) at framet.Gui. (Gui.java:21) at framet.Gui.main(Gui.java:53)  - 
                    1This is because java is having trouble finding the image. You need to make sure the images are located in the same folder as Reel.java – satnam Nov 23 '16 at 18:08
 - 
                    they are in the same folder the SRC folder, i have added the screen shot – JohnDoe Nov 23 '16 at 18:15
 - 
                    You can look at this for help on loading an image from your filesystem: http://stackoverflow.com/questions/16631636/what-is-the-correct-path-to-display-an-imageicon-png-file-for-windows-7 – satnam Nov 23 '16 at 18:18
 - 
                    Ok, finally see your screenshot. You are trying to load "seven.png" and the image is called "redseven.png" – satnam Nov 23 '16 at 18:24