Results 1 to 4 of 4

Thread: File System

  1. #1
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    7

    Default File System

    I'm making a slide show applet. I want to be able to have the user just put pictures into the designated folder and for java to go and randomly select one to use. Is there an easy way to do this or do I have to know what the file names are ahead of time.
    My IP address is 127.0.0.1

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default File[] list = .....

    Java Code:
    File[] list = (new File(".")).listFiles();
    You may have to read up on it, this is without looking at the actual call. It will show up correctly by just googling what I coded.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    Or you could use the list() method with a filter to allow you to list only files that you think are images.

  4. #4
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    7

    Default

    ok thanks I will try this out then when I finish the project I will post it here and sourceforge.
    My IP address is 127.0.0.1

Similar Threads

  1. Listing file system from root directory
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 04-18-2009, 10:03 AM
  2. How to display a file system in a JTree view
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:43 PM
  3. Replies: 0
    Last Post: 04-04-2008, 02:48 PM
  4. Accessing client file system
    By revathi17 in forum New To Java
    Replies: 1
    Last Post: 10-17-2007, 10:17 AM
  5. Disk File System Access and Monitoring
    By drveresh in forum Advanced Java
    Replies: 1
    Last Post: 07-03-2007, 02:01 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
  •