hi,
My project contains a folder images.One Frame contain Jlabel.I want to display the images (at a time one image) from the folder images to the jlabel.could you please answer how to solve this?
I have loaded a single image using the following query

     Image im=new ImageIcon(this.getClass().getResource("/images/a1.jpg")).getImage();


 But I need to display the images randomly from the folder.Plase help

The question is pretty vague, but seems to be in two parts:
How to display random image? Have an array containing all the file names and pick a value from it using a random integer. You can get an array of all the files with a particular extension in a folder using a method from the File class. If the names are all like a1, a2 etc just concatenate a random int to theletter "a".
How to display the images one at a time? Use a javax.swing.Timer to run a small method at regular intervals. In that method just set the label's ImageIcon to the next random image.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.