Results 1 to 2 of 2
  1. #1
    QuinnMal is offline Member
    Join Date
    Jul 2007
    Rep Power

    Default Random Image on Refresh (FROM Folder not set number)

    I want to know how I can write a Java program for Random Image Rotation. Now I have looked online, spent time researching, however I cannot find exactly what I need.

    I need a Random Image Script that will Display an image on my webpage (which when clicked on, links to the image). The image will change on Refresh. I want the script to be able to pull the random images from a folder "Images" and to randomly pick an image in the folder and display it. The images can be named whatever they want to be, and there is no limit/restrictions on numbers. all are .jpg though.

    Anyone able to help me out? Since every bit of Java Random image rotation tutorials/scripts I find online are all where you have to either A: List all your images in the file, or B: Name every image the same way.


  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Rep Power



    I guess you are trying to do that with applets.

    Applets are client side technologies. Because of that they can only access to the files on the server just like you access them with your browser (they cant explore your server in an easy way!). I guess this is why the existing examples requires you to have to either A: List all your images in the file, or B: Name every image the same way. So that client side will know the place of files and access them easily.

    If you want to do that without above requirements, you will need to access a web server directory where your images will be placed. Get list of files from the HTTP response and parse the response to obtain names of the images! After obtaining the list of image names, i guess you already know how to select an image randomly.

    Let us know if you need further help.

Similar Threads

  1. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 10:44 PM
  2. Replies: 0
    Last Post: 01-08-2008, 05:29 PM
  3. add password to folder
    By ismailsaleh in forum AWT / Swing
    Replies: 1
    Last Post: 01-08-2008, 05:46 AM
  4. Generate a random number
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:23 AM
  5. How to generate random number in java
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 07:32 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