Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2013
    Location
    Dublin
    Posts
    32
    Rep Power
    0

    Default Trouble populating a JList using a database ?

    I am trying to populate a Jlist for information stored on a database. The database contains football club names, but instead of being populated with their names it just has a hexadecimal reference ( Club@183357c4 ) for each club object.

    any help on this matter would be appreciated :)
    Last edited by Castro__711; 01-13-2014 at 02:54 PM.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Trouble populating a JList using a database ?

    You either need a Renderer or you have to override your Club's toString method. What you see is the String representation of a Club instance.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Join Date
    Dec 2013
    Location
    Dublin
    Posts
    32
    Rep Power
    0

    Default Re: Trouble populating a JList using a database ?

    Ok I have heard of a Renderer but that is all not got much knowledge on it. thank you for a quick reply.. I will go and try and learn how to apply it.. If I was to override the toString() method could you give me some guidance on where I should do it please ?

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Trouble populating a JList using a database ?

    In your Club class.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  5. #5
    Join Date
    Dec 2013
    Location
    Dublin
    Posts
    32
    Rep Power
    0

    Default Re: Trouble populating a JList using a database ?

    Quote Originally Posted by PhHein View Post
    In your Club class.
    Thanks very much. I have Overrided the toString() method and it is working fine.

Similar Threads

  1. best practice populating ui from database
    By keuninkske in forum New To Java
    Replies: 0
    Last Post: 12-22-2013, 04:02 PM
  2. populating jtable from database
    By java_begin in forum New To Java
    Replies: 1
    Last Post: 01-16-2013, 11:56 PM
  3. Replies: 3
    Last Post: 05-16-2012, 09:57 PM
  4. Populating a JList from a text file - Netbeans
    By Ben1 in forum AWT / Swing
    Replies: 1
    Last Post: 01-13-2011, 03:30 PM
  5. populating a JList
    By hariza in forum AWT / Swing
    Replies: 2
    Last Post: 09-30-2010, 03:53 AM

Tags for this Thread

Posting Permissions

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