Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reading Random image from a folder

821071Aug 30 2011 — edited Oct 6 2011
Hi to all;
--------------
I have a folder called " image " , i want to read random image to display over panel . How can i do this ?
--------------------------------------------------------------------------------------------------------------------------
I know the to read an image file , it's like this :
BufferedImage image =ImageIO.read(getClass().getResource("Sunset.jpg"));
But how can i read it randomly from a folder have a lot of images .

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2011
Added on Aug 30 2011
13 comments
1,508 views