Results 1 to 3 of 3
  1. #1
    hariza is offline Member
    Join Date
    Aug 2010
    Posts
    24
    Rep Power
    0

    Default populating a JList

    Hi,

    I have to create a JList and the items I need to display are store in HashMap table. What would be the easiest way to populate this JList. Basically the items I want to display/show in the JList are the key values of the HashMap. Thanks in advance for any suggestions.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You could always get the key set via HashMap's keySet() method, and Sets are iterable. Check out the API for details.

  3. #3
    hariza is offline Member
    Join Date
    Aug 2010
    Posts
    24
    Rep Power
    0

    Default

    Thanks A lot!!. It sound like that is the way to go. I was even thinking of getting the keyset values and create an array.

Similar Threads

  1. Populating Jtable from database - better way?
    By madhura2212 in forum AWT / Swing
    Replies: 5
    Last Post: 10-05-2010, 03:04 PM
  2. Populating JTable with 2 arrays (Netbeans)
    By althair in forum AWT / Swing
    Replies: 3
    Last Post: 12-30-2009, 03:05 PM
  3. Populating a JTable
    By toymachiner62 in forum New To Java
    Replies: 2
    Last Post: 10-13-2009, 06:56 AM
  4. Error when populating the data
    By srinivas_k543 in forum Java Servlet
    Replies: 2
    Last Post: 07-10-2009, 09:29 AM
  5. Pre-Populating an Outlook Email
    By KeithHenn in forum Advanced Java
    Replies: 3
    Last Post: 10-23-2008, 04:13 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
  •