Results 1 to 2 of 2
  1. #1
    sony144 is offline Member
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Default JList with custom Array

    Hi guys

    I am having a problem at the minute with my JList it is currently reading the data in ok from the JBoss server using a bean which connects to a sybase database.

    The issue I am having is that I wish to customize what the display text is when I set the Data of the jlist. I would really appreciate any help you can offer me as I need to complete this project by the end of today.


    private void UpdateLists()
    {
    jListMailSelect.setListData(currentUserMessageList );
    jListUserSelection.setListData(dbconn.getAllUsers( ).toArray());


    }

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

    Default

    You might want to create a wrapper object that has a custom toString() method to hold each piece of data since default cell renderer used by JList uses toString to display the data. If this is not powerful enough, then you may need to create a custom cell renderer, and the JList tutorial can help you get started with this: JList Tutorial

    Best of luck!

Similar Threads

  1. Custom class in an array?
    By bugmenot in forum New To Java
    Replies: 5
    Last Post: 04-15-2009, 01:10 AM
  2. How to use a JList?
    By glhansen in forum New To Java
    Replies: 3
    Last Post: 03-24-2009, 11:27 AM
  3. JList
    By pinks_70986 in forum New To Java
    Replies: 1
    Last Post: 02-12-2009, 09:36 AM
  4. About JList
    By hungleon88 in forum Advanced Java
    Replies: 5
    Last Post: 08-30-2008, 10:24 PM
  5. Help with JList
    By Albert in forum NetBeans
    Replies: 1
    Last Post: 07-13-2007, 04:42 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
  •