Results 1 to 3 of 3
  1. #1
    delimanyak is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Question How to load a text file into a list on start-up?

    Hi,

    I am currently building an application (just starting to learn java / programming) and was wondering how I would go about loading a text file into a jList as soon as I load my application? I know how to read the text files, I just can't figure out how to make the list load the text file on start-up.

    Any help would be appreciated. Cheers
    Last edited by delimanyak; 05-02-2012 at 10:03 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: How to load a text file into a list on start-up?

    A JList doesn't 'load a text file.' Split your plan into its components parts.

    You say you know how to read a text file; learn how to construct a JList (follow the link to the tutorial from the API), and how to supply the list's contents either at construction or by adding items post-construction. The rest will be trivial.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    delimanyak is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default Re: How to load a text file into a list on start-up?

    Perhaps, I explained badly. I know that the jList doesn't do the actual reading/loading of the text file. I use scanner to read the file and then display it using the list. I know how to display the contents of the text file upon clicking a button. What I am trying to achieve though is to have a certain text file read and displayed when the application is first opens up.

Similar Threads

  1. Friends List (from text file)
    By Kayla in forum New To Java
    Replies: 2
    Last Post: 11-12-2011, 02:42 AM
  2. Replies: 1
    Last Post: 11-16-2009, 08:12 AM
  3. Write a List into a Text file
    By tech2000 in forum New To Java
    Replies: 1
    Last Post: 11-13-2008, 06:09 AM
  4. how to load a java class in startup
    By leonard in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 04:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •