Importing contents of a text File into a JList

Posted on 2007-10-03
Last Modified: 2013-11-23
Importing contents of a text File into a JList
Question: Hi there!

I have a problem that i want solving fast. I keep trying to Import the contents of a text File into a JList and then place this into a JScrollPane.

I have a text file .
File contents are like this
Marry Rose, 5 Bill Road, 23
Susan Jones, 7 gill Avenue, 60

I need to add names from txt file into Jlist as elements not address and age.

Question by:chadhajay
    LVL 92

    Accepted Solution


    Author Comment

    In your solution you reading complete line but I need to read only name from file Mary Rose and after Comma ","  dont need to list anything in Jlist
    LVL 92

    Expert Comment

    as I said it will get you started, you just need to change that example to pull the details you need out of line and instert them in list (instead of entire line)
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now